1. Buffer command byte 2. Buffer data byte 3. send a extra byte for "end of message" i.e. 0x0A 4. when 0x0A is received, handle buffer. Augusto ----- Original Message ----- From: "thomasn101" To: Sent: Tuesday, December 17, 2002 6:23 AM Subject: [PIC]: SPI Protocol > Hi Everyone, > > I am stuck and I need your help! I have 2 PIC16F877 Micros. They are > communicating with each other through SPI (One master and one slave). > The Master sends 2 bytes of data to the Slave - one is the "command" > byte and one is the "data" byte. The Master IC always sends out the > "command" byte first follows by a "data" byte. The Slave IC gets > interrupted every time the SPI reception is completed. > > Here is my question: How do I write the code so that the Slave knows > which byte is the "command" byte and which byte is a "data" byte? > > Thank you in advance. > 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