Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: galileon on April 25, 2008, 03:07:47 PM
-
Hello,
I am trying to get an ATMEGA8 to talk to my desktop computer using a USB<->RS232 cable, and a RS232<->TTL circuit.
The USB-RS232 cable works fine (I shorted pins 2 and 3 and talked to it using a serial com program - cutecom). I built an RS232<->TTL circuit using a MAX202CPE chip with 5 0.1microfarad capacitors, using the circuit in
http://www.maplin.co.uk/images/300/c2305.jpg
I have connected the TD (pin3) from the RS232 connector to pin 13 on the MAX202, and I should expect the TTL signal to come out of pin 12, and it should go to RXD on my microcontroller.
Similarly, I connected the RD (pin2) on the RS232 to pin 14 on the MAX202, and I should expect my microcontroller to feed its signal from the TXD into pin 11 on the MAX202.
I tried with the microcontroller, nothing works. So I shorted the pins 12 and 11 on the MAX202, ie loopback on itself, and tried to see if it echoed back characters to me. Nothing.
I tried various speeds, and various combinations of stop/start bits and parity, the MAX202 circuit didn't work.
I have already bought a ready made RS232<->TTL circuit, and should get it in the post, but I would like to know why this one is not working, and how to fix it so I can learn.
Sorry this post is a bit long, but if anyone has an ideas, please tell me, it would be very much appreciated,
cheers,
nawal.
-
I also forgot to add that I checked the voltages on pin 2 and 6 for the MAX202, and they give +10ish and -10ish respectively, so the voltage doubler and inverter are working...
Maybe I'm confusing the flow direction through the whole TTL input/output and RS232 input/output?
Also, anyone know how to test say the output with a led? I saw that somewhere before, but recent googling hasn't helped yet.
-
so it sounds like you are doing everything right.
you should get a loopback when you connect pins 11 and 12 on the max202 so something definitely is not working.
the only 2 things that spring to mind are
1. are you using a serial cable between your computers rs232 port and your project? many serial cables are "null modem" cables which means pins 2 and 3 are crossed.
2. if you are using electrolytic capacitors the polarity of the caps between pin2 & VCC and pin6 & GND are the opposite way round from what you might at first think. (took me ages to find this out once...)
if both these are right then maybe a short somewhere? FIBA. (F It, Build Another.)
dunk.
-
Thanks a lot for the quick response Dunk!
I am using a USB<-->RS232 port, with a prolific chip (I think it is this one: http://www.prolific.com.tw/eng/Products.asp?ID=59)
The capacitors are the right way around as in the circuit diagram, but instead of a capacitor between pin6 and gnd, I wired it from pin6 to +5V!
Silly mistake, but I think it's because the picture isn't very clear. I will correct that tomorrow and let you know...(I may also have blown the MAX202 now, so I might need to change that...)
Again, thank you very much!
-
It's working now! Wooohoooo!!
Thank you very much for the help Dunk!
FIBA. (F It, Build Another.)
It was actually my second try, although I used the same components on a fresh board...
You wouldn't believe what I did (ok, maybe you would, coz I'm a noobie ;D), I wrote PIN2 for the green wire, which was meant to go to pin 2 on the serial connection, and yet I soldered it to pin 2 on the MAX202! ditto for Pin3! :D