Shop OBEX P1 Docs P2 Docs Learn Events
need some code! — Parallax Forums

need some code!

ArchiverArchiver Posts: 46,084
edited 2001-11-16 08:32 in General Discussion
Hi all!

Well, I've tested the transceivers using a function generator on the
transmit side, and looking the osc. display on the receiver side...
they work.. next step.. hooking them up to the BS2sx.

Since we only have one BS2SX (waiting for the other one), I thought
that I would hook up the transmitter chip to the BS2 and then half
way across the room i would look at the display of the receiver on an
oscilloscope.

So, it all comes down to this.... does anyone have any code for the
BS2 that I can try out?? I am still a bit unsure on the whole
Manchester stuff..but as Tracy says, do it one step at a time... so,
i'm going to test them without manchester...

in the following line:

serout 0, 396 [noparse][[/noparse]$55, $55, commands, checksum]

what goes in for 'commands' and 'checksum' ?

I'm assuming that the $55 and the $55 are the data bits? or are they
synchronizing bits?



Thanks for the help everyone...have a greeeat day!

Debu

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-16 08:32
    >Hi all!
    >Well, I've tested the transceivers using a function generator on the
    >transmit side, and looking the osc. display on the receiver side...
    >they work.. next step.. hooking them up to the BS2sx.
    >Since we only have one BS2SX (waiting for the other one), I thought
    >that I would hook up the transmitter chip to the BS2 and then half
    >way across the room i would look at the display of the receiver on an
    >oscilloscope.
    >So, it all comes down to this.... does anyone have any code for the
    >BS2 that I can try out?? I am still a bit unsure on the whole
    >Manchester stuff..but as Tracy says, do it one step at a time... so,
    >i'm going to test them without manchester...
    >in the following line:
    >serout 0, 396 [noparse][[/noparse]$55, $55, commands, checksum]
    >what goes in for 'commands' and 'checksum' ?
    >I'm assuming that the $55 and the $55 are the data bits? or are they
    >synchronizing bits?
    >Thanks for the help everyone...have a greeeat day!
    >Debu

    Hi Debu,

    If you are looking at the output of the receiver on an oscilloscope,
    it is nice to have a repeating signal that the scope can lock onto.

    loop:
    serout 0,1021, [noparse][[/noparse]$55, $0,]
    pause 8
    goto loop

    Note for the BS2SX you have to use 1021 (not 396) to get 2400 baud
    rate. More bytes for "command" and "checksum" will come later, after
    you get your other BS2SX and decide what kind of information needs to
    flow between them. The idea is that those messages will consist of
    commands and responses, but you have to decide on that. The above
    program just sends an ascii "$55" & "$0" byte for you to observe on
    the oscilloscope.

    >I'm assuming that the $55 and the $55 are the data bits? or are they
    >synchronizing bits?

    They are not so much for synchronizing as they are simply a rapid
    on-off pattern to get the receiver gain control and "data slicer" up
    to par. Why $55? Because $55 in binary is %01010101. RS232
    transmits the LSB (least significant bit) first. The RS232 byte is
    preceded by a start bit, and finishes with at least one stop bit, so
    the pattern overall should be the following.

    ___-_-_-_-_-__
    _______________-_-_-_-_-__
    ____
    $55 $0 8 milliseconds $55 $0 etc..
    time--->

    Note that the bit pattern for the $0 is %00000000. RS232 is an
    "inverted" logic, so logical "1" is represented as a low level, and a
    logical "0" is a high level. The line rests at a "1" level between
    bytes, called "marking" (from early days when a pen stayed on the
    paper making a "mark", and lifted for a "space"). The start bit is a
    high level and the stop bit is a low level. You may have an inverter
    in your circuit, that will flip all of these levels over. One of
    those levels will be represented by the transmitter ON and the other
    level by the transmitter OFF.

    The 8 millisecond delay in the program is there to space out the
    "packets". The time to send one byte at 2400 baud is about 4.2
    milliseconds, or 8.4 milliseconds for two bytes. Then the 8ms delay,
    then another packet and so on.

    Set your oscilloscope's time base for about 1ms per division, and
    trigger on the edge leading edge of the start bit. Once locked on,
    you should see something like this:

    -_-_-_-_-__
    ___

    If is jitters left and right, sometimes missing the lead-in bits,
    well, that means the receiver is taking its time to come up to level.
    If you see noise in the middle of the "0" byte, or in the middle of
    the 8 millisecond pause, that means that the receiver is picking up
    noise, maybe dropping down to its noise floor. I still don't know
    how much AGC (automatic gain control) your receiver has. You can try
    the experiment with both polarities, that is, with the transmitter
    normally ON or with it normally OFF for the "marking" level. Also,
    try it at different distances, and watch the display to see what kind
    of range you can get with a clean signal, before the jitter and noise
    appear.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
Sign In or Register to comment.