
Originally Posted by
jmgelba
Nice catch.
However I only get 1 byte so in looking at the manual I need to use SERIN2 with the STR qualifier. Awesome I think, then I modify the code to the following and now I get nothing again. It hangs at SERIN2 until the time is up then it jumps to my loop again. Wifi is defined as BYTE[16]
Code:
serin2 portc.7,84,250, main1, [STR wifi\16]
WRITE 50, wifi.0
write 51, wifi.1
write 52, wifi.2
write 53, wifi.3
write 54, wifi.4
write 55, wifi.5
write 56, wifi.6
write 57, wifi.7
write 58, wifi.8
write 59, wifi.9
write 60, wifi.10
write 61, wifi.11
write 62, wifi.12
write 63, wifi.13
write 64, wifi.14
write 65, wifi.15
Serin2 is waiting for 16 characters to be received if you do not send 16 characters it will eventually time out. This is a common issue with serial communication however SERIN2 gives you the "tools" to overcome this.
I use a start character to indicate the start of a command string and an end character as a termination, which is not unusual. A commonly used start character is "!" and end character is $0D (CR). You could follow the LCDOUT protocol and use $FE as the start character the choice is yours.
Having decided which start and end characters to use modify your code and obviously include the start and end characters in the string you are sending.
Code:
serin2 portc.7,84,250, main1, [WAIT("!"),STR wifi\16\%0D]
WRITE 50, wifi.0
write 51, wifi.1
write 52, wifi.2
write 53, wifi.3
write 54, wifi.4
write 55, wifi.5
write 56, wifi.6
write 57, wifi.7
write 58, wifi.8
write 59, wifi.9
write 60, wifi.10
write 61, wifi.11
write 62, wifi.12
write 63, wifi.13
write 64, wifi.14
write 65, wifi.15
Bookmarks