Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 8th December 2005, 01:39 PM   #1
Default Keyboard scanner

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 is offline  
Old 8th December 2005, 03:30 PM   #2
Default Re: Keyboard scanner

Quote:
Originally Posted by TKS
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 8th December 2005, 03:35 PM   #3
Default 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
TKS is offline  
Old 8th December 2005, 03:45 PM   #4
Default Re: mhh

Quote:
Originally Posted by TKS
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 9th December 2005, 05:58 PM   #5
Default 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
TKS is offline  
Old 12th December 2005, 10:08 PM   #6
Default 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
TKS is offline  
Reply

Tags
keyboard, scanner

Thread Tools
Display Modes




All times are GMT. The time now is 04:42 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker