View Full Version : Basic Stamp2sx, MAX232, and Hyperterminal
I am trying to have my BS2sx send data using the TX-434 to a receiver, RX-434, which is connected to a MAX232 chip to then connect to the serial port (RS-232) of my PC. I just want what I send to be displayed to the Hyperterminal!
My receiver picks up garbage no matter if my BS2sx is transmitting or not. I have bypassed the RX/TX package and still get nothing to display. I am using the SEROUT and have double checked my numbers for a Baudrate of 2400. I have all the necessary connections and still cannot figure out what I am doing wrong! Also, when I use DEBUG, everything is correct.
Later, I will need to implement this into a system that will display an object's distance (ft) from a mini-car and the new direction (left/right) the mini-car will take to avoid the object. The collision avoidance program is finished and works fine. Implementing this part will be easy once I can figure out how to send information and have it appear on the hyperterminal correctly. I have combed through some of the topics and still find no help with the similar issues described on this forum.
Here is my code. Please, in any form and from anyone, help would be greatly appreciated!!!!
04-11-2007, 05:09 AM
My receiver picks up garbage no matter if my BS2sx is transmitting or not.
This looks like the first problem to fix before you go on to the BS2 transmit side.
04-11-2007, 10:09 AM
For the receiver end you'll need·something that can discriminate between noise and·a valid transmission, otherwise you'll see alot of noise at the receiver end. As an aside, the most reliable speed I could get out of the TWS/RWS-434 pair is 1200 baud using a BS1 with the TX and a MAX232-Rx-PC as the receiver.
Thanks for the advice everyone, especially about the 1200 Baud. I thought I read that MAX232 can only convert voltage levels at that rate.
I am gonna check to see if I am getting correct voltage levels on my input and outputs.
I have already checked and looped back on the Hyperterminal- it displays what I type, but only when I don't power my RX-MAX232 circuitry; therefore I think it is not an issue with Hyperterminal now.
04-12-2007, 07:04 AM
Thanks for the advice everyone, especially about the 1200 Baud. I thought I read that MAX232 can only convert voltage levels at that rate. said...
The MAX232 can function at much higher speeds. There are a few different versions of MAX232 chips, built by different manufacturers - the slow versions only go to 256 kbps, while the fast ones go to 1 mbps. Check the datasheet for the details.
I know that Hyperterminal and the MAX232 chip work correctly because I looped output pins back into the input pins of each and it displays what I type on the Hyperterminal in both cases. I also checked voltage levels of inputs and outputs and get readings of what is expected, especially on the antennas of the TX/RX package and on the output of the MAX232 to the PC.
Therefore, I expect something wrong with my actual SEROUT command. I have checked and tried various Baud rates for my BS2sx code and adjust accordingly for the Hyperterminal to read. Nothing displays but garbage on the Hyperterminal, even when my TX/BS2sx is not transmitting! I have also bypassed the TX/RX package for now and am just trying to use SEROUT to send data to be displayed on the Hyperterminal (using the MAX232 converter chip still).
What could be wrong? Somehow it seems that the PC ignores the data sent from BS2sx or it displays other stuff incorrectly--this leads me to believe incorrect Baud rate, but I have changed it multiple times. Here is my code simplified:
dat VAR Byte 'Data storage variable
BAUD CON 18447 '1200 Baud
FOR dat = 1 TO 255
SEROUT 0,BAUD,[dat] 'out P0
PAUSE 2000 '2s delay
04-15-2007, 04:22 AM
Hi C, shouldn't the baud through a MAX be true, eg: 2063 and not 18447.
04-15-2007, 04:29 AM
18447 is Inverted, I think that you want to use 2063 (True.)· You're SEROUTing on Pin 0.
If you're trying to send out the numbers 1 - 255, then your line should be:
SEROUT 0,BAUD,[DEC dat]
Update·-- without DEC, Hyperterm assumes everything coming over to be ASCII (and a lot of the values between 1-255 aren't ASCII, as you may know.)· DEC converts the number into ASCII characters of the number.
Post Edited (PJ Allen) : 4/14/2007 8:37:49 PM GMT
I have changed the Baud and it still doesn't work!!!
I also have [DEC dat] back again (originally had it-must've deleted for another purpose previously attempted).
Please, anyone with any ideas to help would be great. I have to complete this ASAP. A simple code like this should work no problem.
Appreciate everyone's input so far
04-15-2007, 06:42 AM
Hi C, ignoring the TX/RX unit can you post a schematic of how you have the Stamp / Max232 /·PC connected.
Attached is a schemtaic of my setup for the MAX232 to PC with one line as the BS2sx input (P0, SEROUT output) included also.
*Note: I thought I should connect the RX line to the BS2sx, but TX line is what has given some results (and a description of each pin states that p11 is Driver Input 1 and p12 is Receiver Output 1).
04-15-2007, 08:29 AM
Hi C, the schematic looks fine , the program looks fine , I think you described the pins right but just so I have it right in my mind you did mean Stamp Pin0 to Max Pin11 and Max Pin14 to DB9 Pin2 and a regulated 5v on Max Pin16. If that checks out and your grounds and capacitors are in place I would suspect the Max chip or its wiring. You know the Stamp and PC are programming and communicating, and if the Stamp will display on Hyper terminal without the Max in place it has to be on the Max or a loose or misplaced wire.
Yea, I already switched out the MAX232, but only have two. I guess I will try to get another one if needed (too little time left, though).
And I already checked my wiring. I hope I figure it out by tomorrow. I greatly appreciate your help.
04-15-2007, 10:11 AM
Regarding the MAX232 -- have you appx +10VDC on pin 2 and ─10VDC on pin 6?
This way you can see that the voltage converters are working (essential they.)
04-15-2007, 11:47 PM
I use the same setup on my PC with a TX on a BS1 project board and it has been working well for a few weeks now. I only just looked at your code and apologize, I'm still getting used to this forum.
I noticed a big difference between your code and mine regarding the number of times data is transmitted.
Mine repeats 10 times, I found the receiver needed to be 'spun up' before it started to work reliably.·Anything more than a PAUSE 40 between sends also had the receiver becoming unstable and noise being received.
· FOR rep = 1 TO 10
··· SEROUT 5,T1200,(64,"sPsv1",stat,rec)
··· PAUSE 10
· NEXT rep
In case you are not using a wire antenna, I tried a few different wire antennas and anything over 6 inches worked for a short distance, 10 inches worked for 60 feed, and no antenna had the receiver missing alot of transmissions just a few feet away.
Hope that helps,
04-16-2007, 12:36 AM
Almost forgot one more thing...·I couldn't get the RWS434/Max232 to work with my USB->Serial converter so its always been on a normal com port.
Thanks swrider!! I will try that later on today or tomorrow to see if it works. I am using the com port too because I could not get the USB to serial converter working either. I have bypassed the TX/RX package and am just trying to figure out how to send data from the stamp to my PC for now. The code is more simplified and it still doesn't work! Hopefully, I will figure something out.
Thanks for the help, C
I get a +8v on pin2 and a -8v on pin6, and all other voltage levels seem fine for the MAX232!
However, I did get a 8.5v and 4.5v, both positive on pin1 (I am pretty sure this is ok) and 0v on pin13 (also seems ok since this is the pin that will receive anything from the RS-232 port, which I am only sending data to).
Thanks for the advice, C
It finally worked! Even with the TX/RX too!!!!!!
Stupid wire making the transmitter and receiver circuits have common ground kept getting loose. And I must've fixed whatever problem I had with the RX/TX when I bypassed them previously.