Shop OBEX P1 Docs P2 Docs Learn Events
transmitter help — Parallax Forums

transmitter help

damiondamion Posts: 39
edited 2005-12-06 10:06 in Learn with BlocklyProp
Hello. So I'm trying to transmit data from my bs2 to a ground station using the serout command. I'm using 1200 baud. I've been going through the manual for pbasic and as near as I can tell·my serout command should look something like this.
··· SEROUT 15,17197,[noparse][[/noparse]"W004B"]
··· SEROUT 15,17197,[noparse][[/noparse]"W014E"]
··· SEROUT 15,17197,[noparse][[/noparse]"W0234"]
··· SEROUT 15,17197,[noparse][[/noparse]"W034A"]
··· SEROUT 15,17197,[noparse][[/noparse]"W0546"]
··· SEROUT 15,17197,[noparse][[/noparse],DEC ABS xTilt,DegSym, CLREOL, 13]
··· SEROUT 15,17197,[noparse][[/noparse]DEC ABS yTilt,DegSym, CLREOL, 13]
··· SEROUT 15,17197,[noparse][[/noparse]DEC (ABS xmG / 1000), ".", DEC3 (ABS xmg), " g",13]

But I'm·not getting anything to transmit. I am also wondering what is meant by inverted, and how do I know if it applys to what I'm working on. Thanks for all the help.
···

Comments

  • edited 2005-11-26 09:00
    It would help to know which device you are working with. Somebody on this forum might have already worked with the same device. Another thing you can do is post links to he device's product page and datasheet.

    Regarding the true vs. inverted question, attached is Inverted.jpg. That's what you'll see monitoring P15 with the Parallax USB oscilloscope when the command SEROUT 15, 17197, [noparse][[/noparse]"W"] is executed. At the left of the screen, the signal is in its (low) resting state. Moving to the right, there is a 1/1200 second high signal, which is called the "start bit", and it signals the beginning of a byte transmission. The next eight 1/1200 second data bits are inverted, so a low signal indicates a binary-1, and a high signal indicates a binary-0. The first three 1/1200 second time slices to the right of the start bit are all low, so they are binary-1s. Next comes the following 1/1200 second signals: high, low, high, low, high, which correspond to binary-01010. This is followed by low resting state again. Since serial communication transmits least significant bit first, the message is actually: %01010111, which when converted to decimal is the number 87, which is the ASCII code for "W".

    Also attached is True.jpg, which shows what's plotted by the Parallax USB Oscilloscope while monitoring SEROUT 15, 813, [noparse][[/noparse]"W"]. The difference between true and inverted signals is that everything that was high in inverted serial messages is now low, and visa-versa. So, now resting state is high, the start bit is low, binary-1s are high, and binary-0s are low.

    Note: After each byte, there is a resting state of at least one 1/1200 seconds. It's referred to as the stop bit, and it's the minimum time before the next start bit can be sent assuming you are using 1200 bps, no parity, one stop bit.· If you are using 1200 bps, no parity, two stop bits, there would be a minimum of 2/1200 second resting state before the next·start bit.

    Post Edited (Andy Lindsay (Parallax)) : 11/26/2005 9:05:59 AM GMT
    798 x 589 - 303K
    798 x 589 - 305K
  • stamptrolstamptrol Posts: 1,731
    edited 2005-11-26 13:21
    damion,

    You're set up for 1200, 8, N, 1, inverted which should let you talk to a 'standard' rs232 device like a computer.

    Two quick checks: Make sure the receiving device signal ground is tied to the stamp's ground ( 0v).
    The wire from pin 15 on the stamp will go to pin 2 or 3 on the receiving device, depending on whether it is set as a DTE or DCE, Try both.
    Finally, your receiving device may need handshaking pins jumpered in order for it to process incoming data. Most likely a jumper from pin 4 to pin 5 on the receiving unit will take care of that.
    As always, "Serial Port Complete", by Jan Axelson is THE reference for serial work.
  • edited 2005-11-26 21:04
    WARNING: If you are trying to connect a BASIC Stamp I/O pin to a serial port, do not use trial and error to determine which is the serial port's transmitting pin and which is its receiving pin. Here is a link I found with Google that will help in determining whether your device is DCE or DTE and which pins transmit and receive:

    http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html

    There are lots more pages like this out there - find one that works well for you a a reference.

    Even with this information, use caution before making the electrical connection. Whenever I connect BASIC Stamp I/O pin to a serial port, I put a 22 k resistor in series even if I'm transmitting to the serial port. In the event of a wiring mistake, I won't end up with a dead I/O pin (or maybe even a dead BASIC Stamp).

    Another thing I do is use a voltmeter to check the serial port pins before making any connections. For example, if I know I'm working with a DCE device with a DB9 port, after consulting that web site, I expect pin 3 to be the receiver, pin 2 to be the transmitter, and pin 5 to be the signal ground. So, with the device's serial port disconnected, I'll power it up and use a voltmeter to test the voltages. After connecting COM/GND to pin 5, I'll connect the voltmeter's positive lead to pin 2, which should be the transmitter. If the voltage is a negative value (-7 V, -9 V, -12 V, etc), that verifies that it's a transmitting pin. Next, I'll try pin 3. I expect to see either zero volts on pin 3, or some voltmeters displays won't settle down because the pin is an input and appears to be "floating". That pretty much verifies that it's an input.·

    There are also RS232 driver chips you can use to protect your BASIC Stamp I/O pins. The MAX232 is a common one.

    <corrected>
    The PC's serial port is DTE, and when you program your BASIC Stamp, you are using a straight through cable to the port on the BASIC Stamp's carrier board, which similar to DCE in that it receives serial messages on pin 3 and sends on pin 2.· In the BASIC Stamp, these signals are coupled so that whatever the BASIC Stamp receives on pin 3 is echoed on pin 2.·

    <corrected>
    A null modem cable can be used connect the Board of Education to some other devices that are otherwise designed to be connected to a PC's serial port; however, the Board of Education's DB9 connector does not support all the signal lines a DCE device like a modem uses.· On the Board of Education, the DCE ready and CTS pins are tied together,·so hardware flow control is not an option.··So long as the other device only·needs only to use its transmit and/or receive lines (pins 2 and 3), a null modem cable is a quick way to make the connection.· SERIN and SEROUT commands can then use 16 for·their Pin arguments to communicate using the BASIC Stamp's SIN and SOUT pins.· The SIN pin·is connected to·pin 3 on the Board of Education's DB9 connector,·and the SOUT pin is connected to pin 2.· Vss is connected to pin 5.·

    One final note, stamptrol's suggestion about making sure Vss is connected to the device's signal ground bears repeating. That's probably the most common mistake we see when connecting a microcontroller to a serial port.

    Post Edited (Andy Lindsay (Parallax)) : 11/26/2005 10:15:53 PM GMT
  • edited 2005-11-26 21:19
    Oops, it's been a while, and I don't remember whether common modems require flow control. If so, the part in the previous post about being able to exhcange data by connecting a modem to a Board of Education with a null modem cable is not correct. I will update the previous post shortly.
  • damiondamion Posts: 39
    edited 2005-11-26 22:02
    so it appears that I'm using the bs2p and an unknown transmitter to a yagi antenna·with an·atmega8-16pc chip
    for the ground station. Can these two communicate and if so do I have to do something two the atmel chip or can it be adjusted for in my bs2p code.
  • edited 2005-11-26 22:40
    Okay, first of all, you are using the Baudmode argument of 17197, which is 1200 8N1 for a BASIC Stamp 2. That's not the correct value for the BASIC Stamp 2p, so the data rate you’re transmitting is not correct. When using either the BASIC Stamp Manual or the BASIC Stamp Editor's Help file, make sure to find the Baudmode entry in the tables for the BASIC Stamp 2p (if that’s what you’re using). From the help file, it looks like the correct Baudmode is 18447 for 1200 8N1 or 2063 for 1200 8I1.

    The "unknown transmitter" part doesn't sound very promising. How do you know which pin to connect to Vss and which pin to connect to P15 with this unknown transmitter? How do you know whether it transmits a frequency and format that the base station is capable of demodulating?

    Without the documentation for the RF units, and the base station, it's hard to know whether or not it will work. The BASIC Stamp 2p is certainly capable of transmitting at 1200 bps, but there are a lot of things that have to be working right:

    - The BASIC Stamp has to be correctly wired to the transmitter
    - The transmitter and receiver have to correctly relay the serial data the BASIC Stamp is sending to the microcontroller in the base station
    - The BASIC Stamp 2p has to be sending the data in the format the microcontroller on the base station expects to receive. If that's 1200 8N1 and the other two conditions are covered, then it should work.
  • damiondamion Posts: 39
    edited 2005-11-26 23:07
    ok well actually my transmitter is is from a hobby kit from pratt hobbies that takes temperature and·pressure data and sends it to a ground station. I know that the transmitter works with the ground station because i've used them togother. I used a multimeter to figure out which pins were vss and vdd. And just hooked them up accordingly. so here is the where I got my transmitter from. http://www.pratthobbies.com/proddetail.asp?prod=CANSAT%2D1. I'm actually going to be using the aerocomm 4790 transcievers but I'm trying to get something working until they arrive.
  • edited 2005-11-26 23:12
    Try correcting your Baudmode argument. There are four different options for 1200 bps; one of them should work.
  • edited 2005-11-27 02:39
    Their docs say to use inverted signals, so use 2063 as your Baudmode argument. Try this:

    SEROUT 15, 2063, [noparse][[/noparse]"S", "Testing 123...", 13]
  • edited 2005-11-27 02:42
    BTW, make sure that first "S" is upper-case.
  • edited 2005-11-27 03:03
    Ha! So many numbers, I'm starting to get them mixed up. 1200 8I1 would be a Baudmode argument of 18447. So, this would be the correct test to try:

    SEROUT 15, 18447, [noparse][[/noparse]"S", "Testing 123...", 13]
  • damiondamion Posts: 39
    edited 2005-12-06 07:29
    hello again out there. I just got my aerocomm transcievers. While trying to come up with the code to transmit on pin 3 with the serout arguement I notice that my debug statements are the only thing that is being transmitted. Any advice?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-12-06 10:06
    damion -

    DEBUG output should appear on pin port 16 (aka SOUT), on the BS-2 Stamps. Are you sure you have identified pin port 3 correctly, and correctly specified it in your SEROUT command? Pin port 3 is physical pin 8 on the BS-2 and BS-2SX.

    Regards,

    Bruce Bates
Sign In or Register to comment.