0

I have a cash register that can be equipped with a serial bar code scanner (EAN13) and I would like to send the code from Odoo (OpenERP) directly using a real RS232 (DB9) port. I've connected the cable but I have no idea hot to send the code to the machine. I mean I know how basically Pyserial works but I don't know if the configuration is right because the ELGIN (the producer) doesn't share any kind of technical information. All I know is that the equipment is compatible with any EAN13 serial BC scanner. The setting I'm using are the following:

--- Settings: /dev/ttyS0 9600,8,N,1 --- RTS: active DTR: active BREAK: inactive --- CTS: inactive DSR: inactive RI: active CD: inactive --- software flow control: inactive --- hardware flow control: inactive --- data escaping: raw linefeed: CR/LF

And this is how I'm trying to send the code to the cash register:

import serial
ser = serial.Serial(0)  
print ser.name          
ser.write("1001000000006")     
ser.close()

Since seems a "one-way-communication" I did't figure out where the error is because Pyhton send the code and exit without errors. Any tips?

  • 1
    You need to attach a real barcode scanner to a test program so you can verify the port parameters and capture the exact sequences that are sent by it. That will give you a starting point to figure out how your implementation differs from the scanner. – Mark Ransom Aug 06 '15 at 18:00
  • I fear you're right. But I'm trying to avoid it because it will be an unnecessary piece of hardware after... I'll see if I can find it one for some days to test it. Thanks. – Federico Leoni Aug 06 '15 at 19:42

1 Answers1

1

Most RS232 barcode scanners are sending EANs in raw form, but in line by line form. Every line has to end with \r\n.

Flash Thunder
  • 11,672
  • 8
  • 47
  • 91