Shop OBEX P1 Docs P2 Docs Learn Events
Serial In/Out Timing — Parallax Forums

Serial In/Out Timing

CastrovinciCastrovinci Posts: 26
edited 2009-07-29 04:58 in General Discussion
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

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-07-29 04:20
    The problem may be in the VB code. Test your program with something generic like a terminal program -- you can do this with the bytes you're sending. Once you get the SX slave side happy and proved then you can move on to the VB stuff.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-07-29 04:58
    [noparse][[/noparse] Just wanted to emphasize the 22K resistor on the SX/SERIN_pin. ]
    323 x 194 - 9K
Sign In or Register to comment.