prop and rs232
Zetsu
Posts: 186
Hello I am working on a project from work where I will receive a decimal number via a serial port and would like to have a prop receive that signal and set a pin high or low depending on decimal received.
This question is in regards to wiring for rs-232, First of all can i wire up the rs-232 connection using any arbitrary pins that are available or does it in fact have to be the p31 32 comms pins for the prop ?
I am aware of needing a rs232 to ttl converter chip and i have one of those... so I would suppose it would just be a matter of connecting 1 of the tx lines and rx lines off that chip to the prop and visa versa for a DB9 connector...
I would like to use other pins then the default ones on the prop because i would like to keep the usbplug available for console debugging functionality.
I hope I explained that right ( It was simple setting this up on a basic stamp and programming it... although there is no real info on how this is done on the prop as far as I could find)...
This question is in regards to wiring for rs-232, First of all can i wire up the rs-232 connection using any arbitrary pins that are available or does it in fact have to be the p31 32 comms pins for the prop ?
I am aware of needing a rs232 to ttl converter chip and i have one of those... so I would suppose it would just be a matter of connecting 1 of the tx lines and rx lines off that chip to the prop and visa versa for a DB9 connector...
I would like to use other pins then the default ones on the prop because i would like to keep the usbplug available for console debugging functionality.
I hope I explained that right ( It was simple setting this up on a basic stamp and programming it... although there is no real info on how this is done on the prop as far as I could find)...
Comments
Here's a link to a serial port merger. It might give you some ideas of how to receive and send data.
I'll edit this post in a bit with a link to Tracy Allen's version of a four port serial driver that works really well. So check back here in a couple of hours (maybe minutes).
Edit: Here's Tracy's thread. He has a couple of versions attached to post #1 of the thread.
Completely arbitrary as long as the pins are not used for something else. You will have to have a separate object for each use with a different name.
Correct if you need true "Legal" rs-232 voltage levels.
Of course. P31..32 are for loading and debugging.
The description on how to do it is usually in the object documentation.
Duane J
True.
But there are converters that convert to 3.3V (MAX3232) (of course then it's not TTL).
MAX3221-MAX3243
And others.
Duane J
Great Duanes think alike.
Is what I am using to convert..
That will be perfect. So you need one of those chips, four 0.1uF capacitors, one D9 connector and that is it. Pick any two propeller pins and wire it up. Then in the software, tell the program which pins you are using.
That chip can do two RS232 ports, so you can wire up another one with another D9 plug.
On the D9, use pins 2 and 3. Pin 5 is Gnd. Is your D9 a male or female plug?
There is a little more to the story i guess.... This is an existing system, the original designer has passed on and is no longer available in any form to ask how he did stuff...
Some of the issues I am going to run into tonight are, he doesn't use any sort of start or stop bit for comms, ( he wrote his own rs-232 standard ) as well as no clock.
I tried doing this with a basic stamp last year, and due to the variation in the rs232 standard I had no luck.
My idea was to just read the values in off the pin one at a time into an array then combine them together in a variable then convert to decimal and take the required action. Thus skipping all the standards that I can't adhear too.
Sure rewriting the other 1/2 of this would fix the standard issue, except its about 10k line C program, that was written in 1983 ( year I was born ) and I don't want to spend the amount of time it would take to change it.
Hopefully I can somehow tailor this object to work with this mess ;x
C program executed on a server and spawned to a dumb terminal on the shop floor ( vecmar vt-100), db25 pin from that to db9 to a zilog processor,( current setup)
we have 24 of these processes running on our server and each is being spawned to a different vt-100 which has the option to sound a fire alarm or a tornado alarm, ( over sized time clock )
This is my first real (outside of lighting up leds, and college projects etc.. etc.. ) Embedded system
BTW, just read your latest post, I doubt very much that the signal would not have any start or stop bits but I think you may mean it does not have any start or stop characters that may be used to define a packet. If you give us some details about what is being sent then I'm sure someone can help you out a bit more or at least offer a tip.
There are objects that can do all that automatically.
There are lots of other things you can do too and very easily in Spin. Just let us know your input values and what you want it to be turned into.
Oh, and if you can read these with the prop terminal then that is very good news because it means it is standard RS232 with start and stop bits, so all the objects are going to work right out of the box.
Your whole code might only be 10-20 lines.
PC 5v->MAX3232->propeller at 3.3v
I have to wait for the chips to show up tonight, hopefully everything goes well and I wont be having to order another prop to replace ;x
However, most PCs don't have rs-232 serial ports anymore. Most have USB ports now which need a USB to Serial adapter.
OK, PCs that do have rs-232 ports will, generally, require at least the resistor protection or the MAX3232 powered from 3.3V.
Note! Don't power the MAX3232 from 5V as it will then output 5V to the prop pins. It's in the spec.
Duane J
Cant i just power it off the 3.3v regulator that supplies my prop power ?
Duane J
The MAX chip will not improve anything at all. It's high threshold is 1.7V and it's low is 1.2V, it doesn't do anything with negative voltages at all.
EDIT: I noticed that I shrunk the text box a little in the screenshot so here are the complete figures:
Absolutely. I use a max3232 on all my boards for the download instead of the prop-plug. Then once it is programmed, you get a RS232 port for nothing
Re not needing a max3232, as Peter points out, you can get away without one if you know the voltages on your device. The official RS232 standard is that resting volts are anything more negative than -3V, and a data pulse is anything more than 3V. Voltages between -3V and +3V are not allowed.
However, even more than 20 years ago, there were exceptions, eg 0V counted as a negative voltage.
A RS232 to TTL converter changes the negative volts to TTL high, and the positive volts to zero (ie an inverter. Sort of)
One reason RS232 is useful is that "TTL" volts above is undefined. For many years it was 5V. But now it is more likely to be 3.3V. With the new propeller chip, it will be even lower.
So people stick with the RS232 standard because you don't have to worry about this. Another reason is RS232 is more tolerant of faults. You can short pins together. You can mix up the Tx and Rx and join two Tx pins together. You can muddle up Gnd, Tx and Rx. You can put 12V AC down a pin and nothing will happen. You can't generally do any of things to a chip like the propeller.
There are ways to bend the rules. The picaxe chips have a download circuit that consists of a 22k and a 10k resistor. You can feed a true RS232 signal, minus 12V and plus 12V into the picaxe chip with those two resistors and it won't mind. But that won't work for programming a propeller because the signal is inverted.
As Peter says, if you have two boards next to each other and they are both powered from the same volts, no need to use max3232 chips. You can do the signal inversion in software.
And if one board happened to be powered by 3.3V and the other by 5V, there is a cunning trick using a 2K7 resistor that does the voltage translation.
As a general rule, if I build a box and I put a D9 socket on the side and I don't know what is going to connect to that, I do that with proper RS232 voltage levels. However, within that box, if I know all the specs and I happen to have two devices that use serial (eg a propeller and a picaxe chip), then no need to use RS232 chips.
By that reason then Drac we would never be able to communicate at logic levels to other systems??? That is not the case and unfortunately RS232 is bandied around as a solution and yet the chips that people employ for RS232 don't even adhere to the standard. BTW, the output from the RS232 chip using standard 0.1uF caps and into a load is only around +/-5 or 6V anyway and we have already deduced that the chip accepts +1.3V as a "low". The resistor circuit can easily take 24VAC with nary an eyebrow raised, I use something similar for PLC circuits.
The point here is that the OP can grab a couple of resistors, any old resistors almost, and have the circuit up and running in minutes rather than discussing ad nauseam without ever getting hands on.
If i use the FullduplexSerial driver.. and call Rx to recieve my byte
then at a pc enter the number 9 into the serial terminal i get a dec 57 returned ( i am well aware of ascii so i dont need an explanation )
but..
If i connect up my computer to the dumbterminal at work and wait for it to output i get the 9 in the serial terminal(parallax)..
now is this because the serial terminal(parallax) is converting this for me (from 57 to 9 ) .. or is the dumbterminal really sending dec 9 ??
This should work well for me because i never expect to have a 'real' value > 9
question about your post:
obviously you are correct ( because it works ) but when I look up the signaling specs of rs-232 it seems to conflict directly with your chart ( is this where inverting the signal comes in to place ??)
What i found:
Signal State Voltage Assignments - Voltages of -3v to -25v with respect to signal ground (pin 7) are considered logic '1' (the marking condition), whereas voltages of +3v to +25v are considered logic '0' (the spacing condition). The range of voltages between -3v and +3v is considered a transition region for which a signal state is not assigned.