Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
how can i connect a barcode scanner with ARM microcontroller?
we have connected the barcode scanner with ARM LPC1768. it's taking the input, but we are unable to find it. please tell what to do?
Question relating to:
2 Answers
9 years, 6 months ago.
Try one which have serial I/O Otherwise scanners are frequently seen as keyboards when on the USB.
Please guide me to a documentation or a detailed example on how to use a barcode scanner (having serial I/O) as a input device to an ARM LPC1768 controller. My problem statement is this :
I have a barcode scanner and an ARM LPC1768 controller. The scanner will read two bar codes , say the text equivalent values of those bar codes being 100 & 200. I want to write a program with 2 if loops and an input variable. The input variable should be set to 100 & 200 respectively when the scanner reads appropriate bar codes. That input should drive the controller.
posted by 11 May 2015A few more words: I used a few types (all 'no name') and they were quite easy to use. First is serial 'wand' which used (as I remember - that was some time ago) at 9600 7n1. Interface levels were 5V 'TTL' (so no RS232 per se) and was unidirectional. Once you scaned code you received code over serial line. Piece of cake. Second type which was as easy was 'keyboard type' over PS2 KBD. Interface is well described, piece of cake. Glitch was with coexistence with 'real' keabord but overcome that. Thirs was USB what is a different type of beast. There us standarized interface which have drivers in all decent systems. A minimal subset is in mbed as well - yet I do not remember if keyboard driver on host was implemented, I was using this on linux so was more lucky. The one I had emulated keyboard but with design of new operating systems there is no longer issue with 2 keyboards :)
posted by 18 May 20159 years, 6 months ago.
It would help if you specified which bar-code scanner you were using and how you were trying to access it both from a wiring point of view and a code point of view.
Thanks for prompt reply. I do not remember the exact make of the scanner as it is in my lab right now. But I have tested it works as a keyboard and has provision to use as a serial I/O device also.
From wiring point of view, I am taking an USB hub in between the scanner and the controller. The scanner output USB USB port goes in the USB hub. The hub's output are 4 wires, D+, D-, GND and VCC. I am wiring these with corresponding pins of the ARM micro controller using a bread board.
From code point of view, i do not have any code ready. What I need is to set the values of D+ and D- to 2 input variables and use their value to run a C program, which will set DigitalOut C1, C2, C3 and C4 to binary 1 and 0 (depending on the scanner input being 100 or 200).
posted by 11 May 2015