Hi all, I am new in code warrior, I need help. I am using a QG8 and I need a rutine for SPI, I need to connect the qg8 at other device for SI, and I dont know how to made this rutine.
you are asking a lot
first figure out the message packaging that you need - - - number of bytes, start character, termination character
and method for packet reset so if something gets lost, the packet can recover and be looking for starting byte.
setup the SPI on both micro's - - - such that clock rates are within spec's of both devices - - typically have to be 1/4 of buss clock speed. for the receiver/slave.
Read the SPI document for the micro.
Realize that each time you send a byte you receive a byte. And many times what you receive is garbage - - -
in code give time for the receiver to receive each byte and respond - - - -
a write to the SPI data register triggers the SPI byte transfer - - one byte out and one byte in.
great for high speed micro to micro
but also great for all of the one chip interface chips - - - A/D, D/A etc.
Retrieving data ...