I'm trying to get serout data to go right back into the same pic 16F688 on another pin with a wire connecting the two. The serin command doesn't seem to work, but I have no way of testing it other then trying to make the light blink on/off which it doesn't unless I comment out the serin command. With the code below, the light never comes on.
'Port C.0 and C.1 are connected with a wire.
CMCON0=%00000111
ANSEL=%00000000
TRISC=%00000010
INCLUDE "modedefs.bas"
n VAR BYTE
m VAR BYTE
loop:
PORTC.2=1 ' Turn off LED connected to PORTC.2
n = 12 ' Value to Send out Serial Port - Any old number will do.
SEROUT PORTC.0,T2400,[n]
Pause 1000 ' Delay for 1 seconds
m = 0
SERIN PORTC.1,T2400,m
If m=0 then PORTC.2=0 'Turn on LED connected to PORTC.2
Pause 3000 ' Delay for 3 seconds
Goto loop ' Go back to loop and blink LED forever
End
Bookmarks