Try our online PLC Simulator- FREE. Click here now to try it. |
Learn quickly with our PLC Training DVD Series: on sale
Click here now for details! Using RS-232 with Ladder Logic Now that we understand what RS-232 is/means let's see how to use it with our plc. We
should start out as always, remembering that a
plc is a plc is a plc... In other words, understand the theory
first and then figure out how our manufacturer of choice "makes
it work". Some manufacturers include RS-232 communication capability
in the main processor. Some use the "programming port" for
this. Others require you to purchase (i.e. spend extra $'s) a module
to "talk RS-232" with an external device. To communicate via RS-232 we have to setup a few things. Ask yourself the following questions:
If you know the above, then the rest is easy. If you don't know the above, then make something up and now the rest is easy. Huh??? Simple, pick a memory area to work with and figure out if we can choose the internal relays to use to send and receive data or if the plc has ones that are dedicated to this purpose. Sounds too simple?? (No way, it is simple!!) Before we do it, let's get some more technical terms out of the way so we're on the same playing field.
With the mumbo-jumbo out of the way let's see it in action. Again, the memory locations and relays vary by manufacturer but the theory is universal.
We'll send the string "alr" out the plc serial port to an operator interface when our temp sensor input turns on. This means our oven has become too hot. When the operator interface receives this string it will displayed an alarm message for the operator to see. Look back on the ASCII chart and you'll see that "alr" is hexadecimal 61, 6C, 72. (a=61, l=6C, r=72) We'll write these ASCII characters (in hexadecimal form) into the individual data memory locations. We'll use DM100-102. How? Remember the LDA or MOV instruction? We'll turn on our send relay (1000) when our temperature sensor (0000) turns on. The ladder is shown below. Some plcs may not have dedicated internal relays that send out our data through the RS-232 port. We may have to assign them manually. Further, some plcs will have a special instruction to tell us where the data is stored and when to send the data. This instruction is commonly called AWT (ASCII Write) or RS. The theory is always the same though. Put the data in a memory location and then turn on a relay to send the data. Learn quickly with our PLC Training DVD Series: on saleClick here now for details! |
||
copyright © 1996-2011 by Phil Melore.
All rights reserved. |