Shop OBEX P1 Docs P2 Docs Learn Events
Receiving data from modem... — Parallax Forums

Receiving data from modem...

ArchiverArchiver Posts: 46,084
edited 2003-07-23 14:36 in General Discussion
When I send an ASCII char(in binary form) from a modem to a BS2, I
don't need to declare ASCII variables in BS2 rite? BS2 automatically
reads the binary data and know that it is an ASCII char? Am I right
about this?

As I will be sending data from my pc thru my modem and then to a
remote modem(this remote modem interfaces with my BS2), Can I make
use of RTS and CTS pin? From the manual, seems like the RTS pin and
DSR pin are connected together. This means they are always in the
receiving mode right?

Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-23 14:36
    1. When the BS2 receives a byte, it recieves
    a byte. It is 8 bits of binary information.
    The BS2 does have a wonderful set of modifiers,
    so you can load variables appropriately.

    Let's use '0' as an example.
    You can send the BS2 a CHR(0) (ie the actual
    8-bits of 0). You can send the BS2 an ascii
    character "0" (which is REALLY CHR(48)).

    If you want to send the BS2 an ascii "0", and
    want to BS2 to store a real 0 when it gets it,
    you can put it into a string with:

    MyStr(3) VAR BYTE ' Declare a 3-byte string
    MyVal VAR BYTE ' Declare a single byte

    SERIN SerPin, SerBaud, [noparse][[/noparse]STR MyStr\1]
    ' The above line will put the char "0"
    ' into MyStr.

    ' *** OR, you could do ***
    SERIN SerPin, SerBaud [noparse][[/noparse]DEC MyVal]
    ' I believe the above will put the value
    ' 0 into MyVal

    So the short answer is NO, the BS2 does
    not 'automatically' know when you are sending
    it a char "0" or a byte 0, you have to tell
    it in the code how to receive and store what
    you want. If you use the 'STR' modifier, it
    will stick the bytes as sent into a byte array,
    which is typically what you want done with a
    string.

    2. The DB9 RTS and DSR pins are tied together on
    the BOE board so the IDE can detect it has a
    BS2 connected to it. The BOE DB9 also has DTR
    tied to the BS2 RESET(ATN) pin. This DB9 only
    works for TX and RX, really, and even then it
    echo's everything recieved on is RX pin back
    out its TX pin.

    (Note 232 'hardware handshake' standard is to use
    RTS/CTS as a 'ready for bytes' handshake,
    DCD for 'carrier detect' (the modem is connected)
    and DTS/DTR for 'Data Terminal Ready'
    handshake. The BS2 use of these signals
    is ENTIRELY non-standard.)

    If you can code around all these limitations, then
    you can connect it to your modem. (I wouldn't use
    RTS/CTS with the modem -- but they do support
    XON/XOFF 'soft' handshakes, don't they?)

    The alternative is to put in a MAX232 (for TTL to 232
    and back signal conversion), and install your own DB9
    with whatever hardware control pins you need.

    --- In basicstamps@yahoogroups.com, "barangsg" <barangsg@y...> wrote:
    > When I send an ASCII char(in binary form) from a modem to a BS2, I
    > don't need to declare ASCII variables in BS2 rite? BS2
    automatically
    > reads the binary data and know that it is an ASCII char? Am I right
    > about this?
    >
    > As I will be sending data from my pc thru my modem and then to a
    > remote modem(this remote modem interfaces with my BS2), Can I make
    > use of RTS and CTS pin? From the manual, seems like the RTS pin and
    > DSR pin are connected together. This means they are always in the
    > receiving mode right?
    >
    > Thanks
Sign In or Register to comment.