Hi, Anyone using the CCS PCM built-in SPI drivers in slave mode? There is no documentation or demonstration code for the slave mode but, on trying it out, it seems that writing constants as opposed to a variable generates different code..Code generated for the constant actually reads the SSPBUF (and discards the data) prior to writing data to it whereas the variable code ignores this and loses it's way after a while... 0000 01189 .................... spi_write(0x02); 01FF 1283 01190 BCF 03,5 0200 0813 01191 MOVF 13,W 0201 3002 01192 MOVLW 02 0202 0093 01193 MOVWF 13 0203 1683 01194 BSF 03,5 0204 1814 01195 BTFSC 14,0 0205 2A08 01196 GOTO 208 0206 1283 01197 BCF 03,5 0207 2A03 01198 GOTO 203 opposed to : 0000 01269 .................... spi_write(Data); 024E 0821 01270 MOVF 21,W 024F 0093 01271 MOVWF 13 0250 1683 01272 BSF 03,5 0251 1814 01273 BTFSC 14,0 0252 2A55 01274 GOTO 255 0253 1283 01275 BCF 03,5 0254 2A50 01276 GOTO 250 Presumably, this doesnt make a difference as long as, if you need to read data from the SPI for every byte received, then you always do a read first otherwise the write instruction may have chucked it. Am I missing a trick, somewhere, or is this a known flakiness? Regards, Dan -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body