Connect BarCode Scanner to Picaxe

kakolon

Member
Hi, I'm traying to read a RS-232 barcode scanner setup in 9600-8-N-1, to a 18X picaxe.
I tried to read a 13 digits barcode, with this code:
'------------------------------------------------------------
main:
setfreq m8

serin 6, N4800,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
debug

goto main
'------------------------------------------------------------

Nothing ever happens when I scan the barcode. The variables never fill.
I checked with windows HyperTerminal that the barcode scanner is sending correctly.

Any Ideas ?

Thanks,
Kakolon
 

inglewoodpete

Senior Member
1. Are there handshaking leads that are require to be in centain states before the reader will transmit?
2. Is data being received by the PICAXE? A simple piece of code will help to start with:

Code:
Loop1:  Do Until pin6 = 1
           Loop
           Debug '(or flash a LED with PulseOut)
           Do Until pin6 = 1
           Loop
           Goto Loop1
 

hippy

Technical Support
Staff member
Also, is the barcode scanner taking power from the PC's serial port ?

You can also try a single byte read "serin 6, N4800,b0". You may be getting something, but not everything. The "Nxxxx" baud rate should be correct for something which connects to a PC.
 

kakolon

Member
Hi,
No, It has an independent power supply.
I think what Inglewoodpete said about the handshaking could be the problem, I have read the pin 3 of the barcode scanner DB9 while reading a codebar, and I never get something more than 0.3 volts.
Hippy is the ciurcuit in your web page for making a loop with tha handshake correct for this issue ?
 

kakolon

Member
I found the problem, the thing was that I was expecting data output "TX" in pin 3 of the DB9 of the barcode scanner, RS-232 standards says TX is on pin 3. Well the barcode cable has already switch the TX to pin 2 of the DB9, that way it is already prepared to plug it in the PC port directly without the need of a NULL cable.
I can now get all the barcode numbers in the picaxe
Thank for the replays,

Best regards,
kakolon
 
Top