here is what i got:
#chip 12F683, 8 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
Ser_Init
dim Temp1 as byte
dir gpio.0 out 'serial out
dir gpio.1 in 'SERIAL IN
InitSer 1, r2400, 1, 8, 1, none , normal
#define RecAHigh GPIO.1 on
#define RecALow GPIO.1 off
start:
SerReceive 1, Temp1
if temp1 = 97 then
Xmit_print("a")
end if
if temp1<>97 then
Xmit_print("b")
end if
goto start
Sub Ser_Init
#define baud 416;the us delay for 2400 baud rate
#define SerTxHigh Set gpio.0 on
#define SerTxLow Set gpio.0 off
SerTxhigh ;Initial RS232 idle state
end sub
sub XMIT_PRINT (PrintData$)
PrintLen = PrintData(0)
if PrintLen = 0 then exit sub
'Write Data
for SysPrintTemp = 1 to PrintLen
XMIT_RS232(PrintData(SysPrintTemp))
next
end sub
Sub XMIT_RS232(Xmit_Byte)#NR
SerTxLow ;Start bit
wait baud us
For cntr = 1 to 8
Rotate Xmit_Byte Right
If Status.C ON Then SerTxHigh
If Status.C Off Then SerTxLow
wait baud us
Next
SerTxHigh ;Stop bit
wait baud us
end sub
but I only get the first bit to store in temp1 and not a full byte? so when I send an "a" to it I always get a "b" back.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
here is what i got:
#chip 12F683, 8 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
Ser_Init
dim Temp1 as byte
dir gpio.0 out 'serial out
dir gpio.1 in 'SERIAL IN
InitSer 1, r2400, 1, 8, 1, none , normal
#define RecAHigh GPIO.1 on
#define RecALow GPIO.1 off
start:
SerReceive 1, Temp1
if temp1 = 97 then
Xmit_print("a")
end if
if temp1<>97 then
Xmit_print("b")
end if
goto start
Sub Ser_Init
#define baud 416;the us delay for 2400 baud rate
#define SerTxHigh Set gpio.0 on
#define SerTxLow Set gpio.0 off
SerTxhigh ;Initial RS232 idle state
end sub
sub XMIT_PRINT (PrintData$)
PrintLen = PrintData(0)
if PrintLen = 0 then exit sub
'Write Data
for SysPrintTemp = 1 to PrintLen
XMIT_RS232(PrintData(SysPrintTemp))
next
end sub
Sub XMIT_RS232(Xmit_Byte)#NR
SerTxLow ;Start bit
wait baud us
For cntr = 1 to 8
Rotate Xmit_Byte Right
If Status.C ON Then SerTxHigh
If Status.C Off Then SerTxLow
wait baud us
Next
SerTxHigh ;Stop bit
wait baud us
end sub
but I only get the first bit to store in temp1 and not a full byte? so when I send an "a" to it I always get a "b" back.