Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Keyboard scanner

Status
Not open for further replies.

TKS

New Member
How difficult is it to connect an keyboard / barcode scanner to an pic and be able to recieve the data from it?

any one ideas?

what kind of communication is this? serial??

Tks
 
TKS said:
How difficult is it to connect an keyboard / barcode scanner to an pic and be able to recieve the data from it?

any one ideas?

what kind of communication is this? serial??

Obviously it depends on the bar code scanner, but if it's one that plugs into a keyboard port then it just emulates the keyboard. The keyboard port is an asyncronous serial protocol, modern ones are PS2 type, you can download PIC code from EPE magazine. Check the long running thread on PS2 interfacing, although he's using C.
 
mhh

well i have found an couple of good sites

and i thingk that the scanner just watches and when there is no activety

it starts sending the data.... (its all in the protocol of the AT interface)..


ok, thik i will give this an go rather than USB or RS-232....

because at least i can then implement the power feed without modding the scanner, also PS2 is more common than RS-232 scanners..


Tks
 
Re: mhh

TKS said:
ok, thik i will give this an go rather than USB or RS-232....

because at least i can then implement the power feed without modding the scanner, also PS2 is more common than RS-232 scanners..

Difficulty levels - scored out of ten:

Serial - 1.

PS2 - 3.

USB - 40/50.

Serial is by far the simplest, but PS2 is pretty easy - if PS2 scanners are easier (and cheaper) to obtain, that's the way I'd go. I'd only go the USB route if they were massively cheaper, and I couldn't get serial or PS2 ones.
 
Nigel

Thanxs nigel,

the problem with RS-232 is that many clients then will need to invest in an RS-232 scanner...and abviuosly it isn't nececary as you said,

PS2 is question of time and knowing rs-232 basics...
also there are already many ps2 examples arround..

but USB is an hole other ch*t...its more like networking..
and at a level not within my range yet..

altough i hope that the PS2 scann doesn't do really strange things because... i'm certain that debugging what it does while you switch it on..
won't be that easy..

would there be an PS2 spy program arround?? i gues no no..RS-232 is there already...sow that would be better able to look what it sends...

Tks
 
Need an bit of help!

If the clock and data lines are both high the keyboard sends the (0) start bit, 8 data
bits, the parity bit and the stop bit. Data will be valid before the trailing edge and
beyond the leading edge of the clock pulse.


can any one explain this to me please?Does it mean that i need to capture the state of the data line when clock is high or when its low?

I'm now doing this:

If clock=0 Then ''when the keyboard wants to send data he pulls it to low level..

HSerout ["Data ready"] ''to debug console...

For bbit=0 to 10 '' 1 start bit, 8 data bits 1 par 1 stop bit...

last=1 ''security to captura data on seperate clock highs..??

While last=1 ''security to captura data on seperate clock highs..??
Delayus 4
If clock=1 then last=0

Wend

If ddata=0 then CLEARBIT vvalue,bbit

If ddata=1 then SETBIT vvalue,bbit

''HSerout ["Bit:",dec bbit,";",dec ddata," "]

Next bbit

HSerout ["RECV:",BIN VvAlue,10,13]

End if

When i hit an key on the keyboard i recieve Value 0! 2 times..

1 time because of making some key, another one because releasing some key...

now the trick should be that my timing or my scanning should be an bit better because in fact i never read ddata high...

Both Clock and Data are connected to 5volts with an 10K restitor like in the examples on the net.

what goes wrong??

Tks
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top