I am attempting to get two M2's to communicate via serout and serin. But I am having trouble finding a neat solution for having the receiver process inputs of varying lengths. I am using a 16x2 LCD for outputting the data. LCD code is taken from the interfacing circuits document and works fine (so I've left that out of this code listing).
Sender:
Receiver:
This does not seem to be the way to do this!
The output from the screen is:
Each ";" appears every second, so there is some interaction between the two pics, but it is not doing what I want.
Your help is greatly appreciated!
Sender:
Code:
main:
serout B.0,N2400,(5,"Hello")
pause 1000
serout B.0,N2400,(7,"Goodbye")
pause 1000
goto main
Code:
'initialise
gosub init
'clear
let b1 = 1
gosub wrins
'hide cursor
let b1 = 12
gosub wrins
'display some text to confirm screen works
eeprom 0,("Hello World! :D")
for b3 = 0 to 14
read b3,b1
gosub wrchr
next b3
'go to 2nd line
let b1 = 192
gosub wrins
start:
'read length
serin C.7,N2400,b3
pause 10
for b4 = 1 to b3
'get next character
serin C.7,N2400,b4
pause 10
let b1 = b4
'write to display
gosub wrchr
next b4
goto start
The output from the screen is:
Code:
Hello World! :D
;;;;;;;;;;;;;;;;
Your help is greatly appreciated!