Shop OBEX P1 Docs P2 Docs Learn Events
Problems with SEROUT in a loop — Parallax Forums

Problems with SEROUT in a loop

Dave ScottDave Scott Posts: 4
edited 2006-10-17 01:27 in General Discussion
I am using an SX 28 to transmit some data via SEROUT to an RF Module. The transmit code is
as follows:

DO
' send a few junk bytes to wake up the receiver
FOR i = 1 TO 5
TX_BYTE JUNK
NEXT

checksum = arg1 + arg2
TX_BYTE SYNC
TX_BYTE arg1
TX_BYTE arg2
TX_BYTE checksum

Snooze 40
LOOP

where TX_BYTE wraps SEROUT and Snooze wraps PAUSE. Everything works fine when the sleep value is less than 40 ms. Any value higher produces junk on the receiving end. This is very counter-intuitive as it seems that the faster I send the data the better.

The same transmit code running on a BasicStamp works perfectly, no matter what the pause value is, so I know the problem is in the SX\B transmit code. Interrupts are not enabled.

Is the IO pin somehow being inactivated or does a longer pause somehow interfere with a subsequent SEROUT?

Any help would be greatly appreciated.

Comments

  • BeanBean Posts: 8,129
    edited 2006-10-17 01:27
    Dave,
    The receiver is probably losing the transmitter.
    Try sending more junk bytes or inverting the serial data on both ends if you can.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.
    ·
Sign In or Register to comment.