Thanks elektroline, your VB allowed me to compare with what i had and the reason the serial data coming back was goofed was because of one of the setting in Comm1.
I'm still not convinced i have the PIC code right though, does this look right?
As i say, if i send a 1 from VB nothing if i send t1 or a1 or any letter followed by 1, then the LED flashes and the command is sent back to VB.
Code:
include "modedefs.bas"
Clear
DEFINE OSC 20
DEFINE LOADER_USED 1
ADCON1 = %00001111
In VAR PORTA.5
Out VAR PORTA.4
Loop Var Byte
LED VAR PORTB.1
test var word
test = 1
TRISB = %10000001 ' Set PORTB (0)INPUT (1-5)OUTPUTS
Start:
SERIN IN, N2400, [#TEST]
IF TEST = 1 THEN
GOSUB FLASH
ENDIF
write 3, test
' IF test = 1 THEN GOSUB FLASH
pause 500
' low PortB.1
read 3, test
SEROUT out, N2400, ["That Worked ", #test + 5] ' Senda the wording "That Worked" and a number
GOTO Start
Flash:
For loop = 1 to 5
LED = 1
Pause 100
LED = 0
Pause 100
Cheers,
Bookmarks