Serial In/Out Timing
Castrovinci
Posts: 26
Hello,
·· I am having issues with the timing of the serial in command.· I am using visual basic to send a simple 1 or 2 depending on my outcome and the Sx chip needs to pick it up and go high. (nothing orginal here) but the problem I am having is that it works great for about 4 seconds and then it seems like it is timing out then works good again.· Sometimes I have to send a serial command like 3 times for the stamp to pick it up.·· I am using an external osc.·· I am thinking that its resetting somehow?· Watchdog timer or reset command?·
Here is the shabby program
DEVICE········· SX28, OSCXT2, STACKX, OPTIONX,turbo
FREQ··········· 20_000_000
IRC_CAL··IRC_FAST
RX_BYTE··FUNC·1, 0
sdata var byte
sdata="0"
· 'pin Ra.3=INPUT SCHMITT
·PLP_A = %1111
·plp_c=%11111111····' pull up unused pins
·output rc
· PROGRAM Start
start:
goto main
Main:
· 'TX_STR "Press a key: "
· sdata = RX_BYTE
·· if sData = "1" then
····· high rc.7
····· SEROUT RA.0, n2400, "A"
··· endif
··· if sdata= "2" then
····· low rc.7
····· SEROUT RA.0, n2400, "B"
··· endif
GOTO Main
''''''''''''''''''''''''''''''''''''''''''''''
FUNC RX_BYTE
· SERIN ra.3, n2400, __PARAM1···' wait for byte
· ENDFUNC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·· I am having issues with the timing of the serial in command.· I am using visual basic to send a simple 1 or 2 depending on my outcome and the Sx chip needs to pick it up and go high. (nothing orginal here) but the problem I am having is that it works great for about 4 seconds and then it seems like it is timing out then works good again.· Sometimes I have to send a serial command like 3 times for the stamp to pick it up.·· I am using an external osc.·· I am thinking that its resetting somehow?· Watchdog timer or reset command?·
Here is the shabby program
DEVICE········· SX28, OSCXT2, STACKX, OPTIONX,turbo
FREQ··········· 20_000_000
IRC_CAL··IRC_FAST
RX_BYTE··FUNC·1, 0
sdata var byte
sdata="0"
· 'pin Ra.3=INPUT SCHMITT
·PLP_A = %1111
·plp_c=%11111111····' pull up unused pins
·output rc
· PROGRAM Start
start:
goto main
Main:
· 'TX_STR "Press a key: "
· sdata = RX_BYTE
·· if sData = "1" then
····· high rc.7
····· SEROUT RA.0, n2400, "A"
··· endif
··· if sdata= "2" then
····· low rc.7
····· SEROUT RA.0, n2400, "B"
··· endif
GOTO Main
''''''''''''''''''''''''''''''''''''''''''''''
FUNC RX_BYTE
· SERIN ra.3, n2400, __PARAM1···' wait for byte
· ENDFUNC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments