Can someone tell me if I am going in the right direction?
Hello all,
So I am attempting to write a program for the Lab X1 and Lab X2 board to talk to one another serially, I have started to put together a code in what I think is reasonably close to what I need to do. Unfortunately, I am having a hard time finding out just how to express some types of commands, as such, I am pretty sure what I have is dead wrong in some way. Can someone tell me if I am at least in the ballpark with what I need to be writing? Any help is very much appreciated.
What I am trying to do is as follows:
The code on the Lab X1 sends a command serially to turn on a led on the Lab X2, right now I just have the program continuously sending the command, just so I can figure out how to send it.
The code on the Lab X2 receives to code and turns on LED2, and keeps it on. It also turns on LED3, to show that the loop is in fact working.
I have the two boards connected by pin D0 on the Lab X1 and pin B0 on the Lab X 2
Here are the codes I have written thus far, they do not work at all, besides turning on LED3.
Lab X1 code:
DEFINE OSC 20
INCLUDE "modedefs.bas"
TRISD.0=1
LED VAR BYTE
LOOP:
LED=%00000001
SERout PORTD.0,T2400,[LED]
GOTO LOOP
END
And the Lab X2 code:
DEFINE OSC 20
INCLUDE "modedefs.bas"
TRISB=%00000001
LED VAR BYTE
LED=%00000000
LOOP:
PORTB.2=1
SERIn PORTB.0,T2400,[LED]
IF LED=%00000001 THEN
PORTB.1=1
ELSE
GOTO LOOP
ENDIF
GOTO LOOP
END
Thank you for putting up with my extremely novice understanding of PicBasic Pro.
Matt