How to setup and use a barcode scanner with a CLICK PLC.
Scanning Barcodes could not be easier with the CLICK PLC! In this video I'll show you just how easy it is! Step 1: I've got an RS-232 scanner, so I'll plug the scanner into Port 2 on my PLC. Step 2: We need to configure Port 2. To do that go to Setup and then Com Port Setup. We need to setup up Port 2 so go ahead and choose that. Port 2 defaults to Modbus RTU but we want to read ASCII so choose the ASCII protocol. Be careful don't forget to do that one. This particular scanner operates at 9600 baud, Odd parity, 1 Stop Bit, and 8 Communication Data bits. CLICK Ok to exit Port 2 setup and then go ahead and close out of the Com Port setup. Step 3: Read the barcode. Bring in a Receive command. Double check that Port 2 is selected. We'll be reading a fixed data length of 10 characters long. You'll understand why in just a minute. The data destination is where to store the string you receive from the scanner. You can choose any TXT address that you'd like I'll go ahead and choose TXT1. The status flags help show the condition of the command. You can choose any C address you'd like. I'm going to go ahead and set Receiving as C1, Success as C2, and Overflow as C3. We didn't set any timeout so you can leave First Character Time-out and Character Interval Time-out blank. When you are done entering everything you can go ahead and hit ok. Add a normally open contact on the first rung and type in C4. Don't forget to add your end statement. Step 4: Transfer you're program to the PLC. And that's it. Step 1 we plugged our scanner in. Step 2 we configured our serial port. Step 3 we configured an ASCII receive command. And Step 4 we transferred our program to the PLC. I don't think it can get any easier than that! To read a barcode, open up a data view window and type in C4. Then click on edit. This will let us toggle C4 on and off, which is controlling our receive command. Turn C4 on by double clicking the on button. Now we can scan a barcode and see it here. Here we can see the 10 character string read from the bar code scanner. The string is stored in TXT1 through TXT10. For our example S is stored in TXT1, M is stored in TXT2, and so on. You can now use these values elsewhere in your ladder logic program. If you want to scan another barcode all you have to do is turn C4 off and then back on. And sure enough we can see a different barcode here. Now that you know how to setup and use a barcode scanner with the CLICK PLC the possibilities are endless!