I have an old barcode reader or an old camera and I want to connect it to the controller to check the barcodes my equipment is printing.
How do I do it ?
What you have to know from the reader
The controller is only interested in triggering the reader and getting a result in time over the serial interface, usually one of the ports of the Dflex card.
The reader setup is either automatic or the reader comes with a software that allows to set it up. The controller has nothing to do with this step. One can use the COM2 in the controller but it is better to use a laptop to set it up once.
Be sure to know what the trigger input is. The controller will give a push/pull signal. You can use the internal 24 VDC and the opto-coupler will switch between 0 and 24 VDC. Be sure no to draw more than 10 mA, otherwise the opto-coupler will be damaged.
Be sure that the reader sends messages with the number to be read followed by carriage return (0Dhex) and Line Feed (0Ahex):
Be sure to know what the serial parameters (baudrate, # data bits, # stop bits, parity, handshake) are. You will have to set the same parameters in the controller.
What you have to define on the controller
Define a reader of type “Standard reader” first in the job.
Double-click to get the reader display.
Encoder is the encoder of the machine segment where the reader is on.
Trigger from Photocell is the photocell used as reference to trigger the reader.
Mode is always matching in this mode.
Trigger Position is the distance between the reference and when the reader shall be triggered.
Trigger Length is the length or duration of the trigger.
Max. Sequential Errors is the maximum number of errors in sequence before a soft stop.
Max. Matching Errors is the maximum number of matching errors in sequence.
Reader number settings have no meaning at this time
1st Code is actually the barcode read by the reader.
Time trigger to Result is the time the controller waits for a result from the reader in milliseconds.
Read Match Trace is to show the matching in the RTX window.
So, the controller is going to compare the barcode with Match Key 1 defined in the database. The length of course varies between jobs. Furthermore, it is going to mark bad (and reorder if selected) the products that do not match.
In the Configuration tab, enter “as expert” the hardware settings.
Box is 01.
Type is Standard Reader.
Number is whatever output number you take to trigger the reader. OUT 04 is just an example
Logic is normally positive. That is, the pulse goes from 0 to 24 V.
Length is Track.
Type is push/pull.
Interface type is Serial Asynchron.
Board is whatever board you connect to. Usually Dflex 1.
Port is whatever port in the board you take. Port 2 is just an example. DB25 male on Dflex.
Baudrate check what your reader delivers.
Parity check what your reader delivers.
Data bits check what your reader delivers.
Stop check what your reader delivers.
Handshake check what your reader delivers.
Use Interface is My Interface.
Usually, I set the handshake to none because the controller is fast enough to get any data at the usual rates of 19’200 baud. But also make sure that the reader does no expect a handshake too. In this case, you really only have to wire 3 cables (pins 2, 3, 7 of a DB25) of a RS232:
Dflex DB25 Connector Other Device (DB 25) Other Device (DB 9)
Rx 2 3 3
Tx 3 2 2
Gnd 7 7 5
So, connect first the Gnd, that is pin 7 if DB25 connectors, or 5 if DB9 connector. Then, you only have to connect 2 to 3 and 3 to 2. Try it, if it does not work, try connecting 2 to 2 and 3 to 3. The explanation is too long, like some countries drive on the left, just try it because there is always a receiver (Rx) and a transmitter (Tx).
How Can I test it ?
Press the test camera icon on the right.
This is what the reader sends, after you press the Trigger button
This is what you chose to check.
Thus, if you press the trigger button, you should see OUT 04 go on and off in the connection box. The trigger signal, if well wired, should make the reader read and send a result that will be shown.
If not, the text in result will be “no result” and you will have to trace the error.
You can always plug in your laptop or COM1/2 of the controller and check with hyper-terminal that the reader is truly sending something through the serial interface.
You can also enter serial_asynch –trace 1 (or 2) in arguments.txt (D:\EditorGT\user\system) if you want to see what the controller driver sees at the port.
Common Barcode readers used:
Keyence BL-600 series for regular barcodes
Cognex Dataman or Keyence SR-500 that also reads 2D barcodes
If you are not seeing the result in the controller but in hyper-terminal, you can solve it by using a null-modem or defining the right end character.
Add –trace 2 to serial_asynch in d:/editorgt/user/system/arguments.txt.
serial_asynch –trace 2
You will see all that goes out and in. also in Hex.
It is very important that you define the end character
If you see
this is standard. It is carriage return line feed
If you see
this is not standard. 0x03 is the end character.
Go to d:/editorgt/user/system/arguments.txt and put in the right reader (reader0 is first reader, reader1 is second reader, and so on)
reader0 –end 3 (this will tell the software that the end character is 0x03)
reader0 –end 13 (this will tell the software that the end character is 0x0D or decimal 13)