All I need to be able to do is specify the following:
Motor ID
Motor Mode
Paramter (speed or # steps depending on mode)
It seems the PIC has a 2 byte buffer. I could use one byte
for passing the parameter, and the first byte to specify the various possible combinations of ID/Mode.
If the PC only ever transmits 2 bytes at a time, and each time the PIC reads it clears the buffer, I should be in the clear.
However, it all depends on how PICBasic works. I assume that if 2 bytes arrive, triggering the interrupt, then when the service routine reads from the serial input, it will first empty the buffer, and, if data is still coming in, read directly from the serial Pin? If the data has already arrived, then presumably it will just read the 2 bytes from the buffer, at which point I need to somehow reset the buffer, act on the received data.
If I know I'm going to be receiving 2 bytes of data, presumably the syntax is:
HSERIN byte1, byte2
where byte1 and byte2 are predefined variables?
Bookmarks