On 3/21/06, Alan B. Pearce wrote: > >Second, am I correct in determining that if I want to > >clock data out of my wireless module, I should keep my > >PIC in master mode so that it generates the clock signal? > >If so, from my understanding I need to write a byte to > >the SSPBUF register. At that point my data will be > >clocked out as the incominging data is clocked back > >into SSPBUF. > > I do not know the wireless modules you are using, but does the receive end > expect the micro to be operating in master or slave mode? If master mode > then presumably it has a dual port ram or FIFO that it can load, and the > micro then empties. If slave mode, then you will need to switch the MSSP > between modes as you move from transmit to receive. I believe the PIC should be in master mode as it needs to supply the clock signal. The wireless module does have a FIFO as far as I understand. > >This poses a problem that I mentioned in my other email. > >Since I need to connect SDI and SDO of the PIC together > >somehow as my wireless module only has one data connection, > > You put a resistor between SDI and SDO. Have a look at the FTDI232B > datasheet (not the R version) for how they attach an EEPROM for > configuration data, as they have the same problem. Interesting...I checked this out. The datasheet I looked at is located at http://www.ftdichip.com/Documents/DataSheets/ds232b18.pdf and the interesting page is 14. Just so I'm clear...this works because the resistor os on the SDO line of the PIC. When the PIC is sending data, it drives through the resistor and all is fine. There is no data coming out of the wireless module, and the SDI pin basically clocks in whatever the SDO pin clocks out. When the PIC is receiving data, I write a dummy byte to SSPBUF and the PIC starts clocking it out while clocking in whatever is on SDI. If SDO and SDI are in contention (for instance if the PIC outputs a 0 bit but the wireless module outputs a 1 bit), due to the resistor, the wireless module wins, and all is happy. So if my understanding is correct, is a 2.2K resistor a reasonable value for this? Thanks! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist