Shop OBEX P1 Docs P2 Docs Learn Events
Software loopback — Parallax Forums

Software loopback

Buck RogersBuck Rogers Posts: 2,178
edited 2014-06-18 09:46 in BASIC Stamp
Hello!
I've written this preliminary program which simply collects data sploshing into a terminal from a serial input function. Then waits a few moments and sends it back via a serial output function.

It looks like this:
' {$STAMP BS2}
' {$PBASIC 2.5}
X VAR Word
DD VAR Word
FOR DD=0 TO 255
SERIN 0, 16468, [X]
PAUSE 2200
SEROUT 1, 16468, [X]
NEXT



What I'm up to is one of taking that idea and translating it into a stream to deliver to a Prop Backpack. Said backpack will be used to display what I'm collecting from the device, a Palm Pilot M100 or Palm Pilot 3x, on a small LCD screen.

Now the audience question, is that the correct way to go about it?

Comments

  • GenetixGenetix Posts: 1,749
    edited 2014-06-13 00:14
    I think you would have better results using a Propeller rather than a BS2 is this case.
    The Palm Pilot is likely to send bursts of data and since the BS2 has no buffer capability data can easily be lost.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-13 11:17
    I think that will depend on how it is implemented. If the BASIC Stamp Module is coordinating communication there shouldn't be an issue. But I am not entirely clear on what you're trying to do. As the program is written it will wait for a byte then wait 2.2 seconds before sending that byte back out. It will do this up to 256 times and then terminate. While it is waiting 2.2 seconds and sending the data out any data coming in will be lost. Was this your original intention?
  • Buck RogersBuck Rogers Posts: 2,178
    edited 2014-06-13 18:22
    Genetix wrote: »
    I think you would have better results using a Propeller rather than a BS2 is this case.
    The Palm Pilot is likely to send bursts of data and since the BS2 has no buffer capability data can easily be lost.

    Oddly enough it works fine without the buffer.
  • Buck RogersBuck Rogers Posts: 2,178
    edited 2014-06-13 18:35
    I think that will depend on how it is implemented. If the BASIC Stamp Module is coordinating communication there shouldn't be an issue. But I am not entirely clear on what you're trying to do. As the program is written it will wait for a byte then wait 2.2 seconds before sending that byte back out. It will do this up to 256 times and then terminate. While it is waiting 2.2 seconds and sending the data out any data coming in will be lost. Was this your original intention?

    It seems to be working. I remembered a problem with the original I/O device a now discontinued DS275 part. According to Mike Green, the part uses inversion to make itself work properly for the purposes of sending and receiving data via the RS232 levels. And to be honest that I did not know.

    Thats the reason why I chose to use the level of 9600 baud and set it to be delivered inverted.

    What I'll do next time I'm working on it, is to make a video and post it.

    Did you try the code incidentally?

    Oh and folks the fact that it works can be attributed to my not buying the Palm device from eBay. That one I bought from Amazon, its a Palm 3x. The other one I tried was a Palm M100.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-15 23:03
    Buck,

    No I did not try the code. It should operate as I stated though.
  • Buck RogersBuck Rogers Posts: 2,178
    edited 2014-06-18 09:17
    Buck,

    No I did not try the code. It should operate as I stated though.

    Okay I've changed the delay time from the one shown of
    PAUSE 2200
    

    to
    PAUSE 220
    

    Turns out that your theory about the delay and the possible loss of data attributed to it, made sense. The change now seems to be working properly.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-18 09:46
    Ideally you don't want any delays in a system like this. Is there a reason to wait 220 ms before sending the received data back out?
Sign In or Register to comment.