Use this utility to enable your controller to receive data from external devices, such as bar-code readers, via an RS232 port. Since there is no Ladder element for this function; you perform it by storing values into SIs.
Note that the communication settings stored into these SIs only take effect at power-up.
SI |
Parameter |
Value to Store |
Notes |
141 |
STX (Start of Text) |
Select one of the 3 STX option by storing its value into SI 141:
|
The STX parameter indicates where the data block begins.
|
142 |
ETX (End of Text) |
Select one of the 3 ETX option by storing its value into SI 142:
|
The ETX parameter indicates where the data block ends. When the ETX is registered by the function, SB 60 turns ON.
|
143 |
ETX Length or Silent |
|
|
144 |
Maximum Length |
Up to 128 |
|
145 |
Start Address: Receive Buffer |
MI Address |
This MI contains the start address for the vector of registers that serves as the Receive Buffer. |
60 |
Number of Bytes currently in Receive Buffer |
Read only |
SI 60 indicates how many bytes of data are currently in the Receive Buffer. |
61 |
Number of Bytes in Receive Buffer when SB 60=1 |
Read only |
SI 61 indicates how many bytes of data are in the Receive Buffer when SB 60 turns ON. |
146 |
Copy Data: Format |
|
|
140 |
Start receiving |
300 |
In your application, use this to call the function after you have entered all of the other parameters. Note that when you run Test (Debug) Mode, the current value in SI 140 will not be displayed. |
SB |
Description |
Notes |
60 |
Data Successfully Received |
Read only. Turns ON when the ETX condition is registered by the system. |
61 |
Copy Data in Receive Buffer to MI Vector |
Write only.
|
62 |
Clear Receive Buffer, Clear SI 60, Clear SI 61, Reset SB 60 |
|
Note that if no data is received for a period exceeding the TimeOut, you will lose the data in the buffer.
To see how to use the Communications Utility, check the sample application Read Card - Display Number Value.U90. This may be found by accessing Sample U90 Projects from the Help menu.
This application demonstrates how to read a magnetic card number using an "IDTECH" card reader, then display that number on the PLC's screen. The card reader transmits the number in ASCII characters in this format:
< %?[CR];xxxxx?[CR] > where xxxxx is the card number.
The ASCII character used to mark the Start Of Text (STX) is < ; > (semicolon). End Of Text (ETX) is marked with the character < ? > .
Since the card number is 5 digits long, the card number is copied to 2 separate MIs. The MIs are linked to 2 variables that are shown on the PLC's screen in 2 separate Displays.
The parameters must be written into their respective operands using one scan condition. For this purpose, it is recommended to use SB 2 Power-up bit, as shown in the sample application.