> I have some problems with the project I am working on, and I need your > help! > > 1. I have 2 devices on the SPI bus (one 16-bit and one 8-bit). > Each device has its own Chip Select signal. What I want to do is: > > For 16-bit device > Select the chip > Send 16 bits of data > Deselect the chip > > For 8-bit device > Select the chip > Send 8 bits of data > Deselect the chip > > I have no problem writing the code for multiple 8-bit devices, but when > it comes to a mixture of 8-bit and 16-bit devices, I am totally stuck. > I am thinking of using a variable in the ISR to indicate whether it is a > 8-bit or 16-bit device, but I think it needs Mutual Exclusion. I am > using the 16F877. Please help! Unless the chip is selected, whatever happens on the clock and data lines means nothing. [16b]: Just select that chip, send the first byte/capture data out, then send the second byte/capture data out, then deselect the chip. [8b]: Just select the chip, send the byte/capture data out, then deselect the chip. > 2. The SPI module on the 16F877 can be configured to run at > different speed. Don't we always want to run it at the fastest speed? Not quite true. Some SPI devices cannot have a clock faster than 1Mhz or even 400Khz. At 20Mhz, the fastest SPI is 4Mhz. > Thank you for your help! > Best regards, > Thomas > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu