This version will send only the target temperatures.
It should send "S" followed by carriage return
Then it should send 12 digits (4 sensors * 3 digits) followed by carriage return
It should then wait 3 seconds to give you time to process stuff, then it will query everything and expect all 108 characters back.
It will then wait 4 seconds, and display what it received
Instead, try:
It should send "S"
(single character, no carriage return)
It should wait for the PIC to reply with "K" (or your favorite acknowledge character)
Then it should send 12 digits (4 sensors * 3 digits) followed by carriage return
It should then wait 3 seconds to give you time to process stuff, then it will query everything and expect all 108 characters back.
It will then wait 4 seconds, and display what it received
Then in your main loop add something like:
nTest var byte
Code:
If PIR1.5 = 1 Then 'check to see if there is data in the serial buffer
HSERIN[nTest]
if nTest = "S" then
HSEROUT["K"] 'Let the PC know to start sending data
HSERIN[....all the rest of your stuff...]
endif
endif
I suspect the PIC appears to lock because it misses a byte. The above slows everything just a little and uses a positive acknowledgement to make sure everything is set.
Hope this helps somehow...
Best Regards,
Paul
Bookmarks