In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mikegann wrote: HI Mike - I see a couple of problems with your code. First is your shiftout commands you are using to configure the device: ' send the configuration bytes to the UART to set up for receiving MIDI input SHIFTOUT UartOutputPin, UartClockPin, MSBFIRST, command1\8 SHIFTOUT UartOutputPin, UartClockPin, MSBFIRST, command2\8 You specify MSBFIRST, which is correct for the MAX3100. However you include the count parameter (\8) which forces the shiftout command to ignore the MSBFIRST and shift out the rightmost eight bits which effectively turns your shiftout comands to: SHIFTOUT UartOutputPin, UartClockPin, LSBFIRST, command1 SHIFTOUT UartOutputPin, UartClockPin, LSBFIRST, command2 Just remove the count parameter, it is not needed in your case. The second problem is the way you are trying to read back the configuration. To write data to be transmitted or to read data which has been received you can use the shiftout / shiftin commands. To read the configuration of the MAX3100 you have to both write the command and read the data at the same time. To do this you can'y use the shiftin / shiftout commands. I have attached a program that writes the configuration, then reads it back. Run it in debug and check the results. The code loop used to simultaneously read and write the SPI data was found on this forum but I do not remember who wrote it to give proper credit. I hope this helps. Mike ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=188222#m188771 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)