Shop OBEX P1 Docs P2 Docs Learn Events
Serial string continuity — Parallax Forums

Serial string continuity

Andy McLeodAndy McLeod Posts: 40
edited 2007-08-21 18:35 in BASIC Stamp
Consider:

DO
SEROUT 9, 84, [noparse][[/noparse]16,73,1,85,134]
PAUSE 500
LOOP

This command will send the series of numbers to a hyperterminal or similar capture device where they will appear as ASCII characters without interruptions. Looking at it on an oscilloscope, however, shows an issue I've never run into before. There appears to be a bit (or two) inserted between each character other than the start and stop bits after each value. I am assuming these are inherent pauses as the microprocessor readies the next value. Does anyone know how to remove this pause so that the values are sent without any interruptions? smhair.gif

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-21 18:03
    Since the Stamp is single-tasked, serial output occurs in the foreground, interleaved with retrieving and preparing the next character to send. So there's no way to eliminate the gap between characters.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-21 18:11
    You can't remove these overhead times. The serial input/output is not buffered so the interpreter has to fetch its next value, then start up the serial output mechanism again which puts out a complete serial frame with its start and stop bits. The fetch of the next value takes a little bit of time and that is indeed what you're seeing. If you absolutely must have no interruptions, you could use an external UART like the MAX3100 which is buffered. The Stamp would communicate with the MAX3100 using the SHIFTOUT / SHIFTIN statements rather than SEROUT / SERIN and there would be some control overhead as well. The BS2 is working pretty hard to keep up with 9600 Baud and you may need to switch to a faster Stamp model. You might find the space between characters decreasing as well with the faster Stamps.
  • Andy McLeodAndy McLeod Posts: 40
    edited 2007-08-21 18:24
    OK, thank you very much for the responses. I was afraid that was the issue. What I am trying to do now is create a PULSOUT command that emulates the pattern that I want. I'll let you know what happens.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-08-21 18:31
    Hi Andy, I have had situations where I would want to transmit one continuous stream of character bytes and I used the string formatter assigning each element of the array with my data

    SEROUT 9, 84, [noparse][[/noparse]STR my_data\5]

    I know its quicker but I have no idea what you would see on a scope so you may or may not see the gaps between bytes. Worth a try?

    I also agree with Mike, when the data starts to get large or the format more complex with a BS2 drop the baudrate.

    Jeff T
  • Andy McLeodAndy McLeod Posts: 40
    edited 2007-08-21 18:35
    Jeff-

    I tried that also, and it expresses the same limitation. Thanks for your input!

    Andy
Sign In or Register to comment.