I'm sorry, earlier I copied down my old code that was rittled with errors and didn't have the input and outputs set. Here is the new code:
INCLUDE "modedefs.bas"
DEFINE OSC 20
ANSEL = %00000000
INPUTDATA var byte
TRISA.2 = 1
TRISB.2 = 0
PORTA.2 = INPUTDATA
X VAR BYTE
X = 0
MAIN:
PORTB.2 = 0
WAITLOOP:
SERIN PORTA.2,T9600,[inputdata]
if inputdata <> "A" then goto waitloop
LOOP:
IF X<4 THEN
HIGH PORTB.2
PAUSE 2
LOW PORTB.2
PAUSE 2
X = X+1
GOTO LOOP
endif
goto MAIN
I want pin A.2 to be the input from the bluesmirf, which will be sending messages to our LCD via serial ports. The serial data will come into the pic through porta.2. Each message that is sent by the bluesmirf will be proceeded by the letter A. I'd like porta.2 to not accept any random data and only activate the loop when a message is recieved that is preceeded by the letter A. The output should be a high then low loop that loops four times. The output should come from portb.2
Bookmarks