0

MCR12 PS/2 Barcode Scanner
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MCR12 PS/2 Barcode Scanner

by Kame77 on Tue May 15, 2018 4:02 am

Hello,
I have the PS/2 version of the MCR12 barcode scanner connected to an Arduino UNO and I am using the PJRC's PS2Keyboard library and the Adafruit PS2 adapter cable. I have the following wire connections:
Black to GND
Green to 5v
Yellow (clock) to D3 (interrupt pin)
Brown (data) to D2

I have the baud rate set to 9600, and I seem to be having a problem with random characters.

Code:
Code: Select all | TOGGLE FULL SIZE
#include <PS2Keyboard.h>


const int DataPin = 2;
const int IRQpin =  3;

PS2Keyboard keyboard;

void setup() {
  delay(1000);
  keyboard.begin(DataPin, IRQpin);
  Serial.begin(9600);
  Serial.println("Keyboard Test:");
}

void loop() {
  if (keyboard.available()) {
   
    // read the next key
    char c = keyboard.read();
   
    // check for some of the special keys
    if (c == PS2_ENTER) {
      Serial.println();
    } else if (c == PS2_TAB) {
      Serial.print("[Tab]");
    } else if (c == PS2_ESC) {
      Serial.print("[ESC]");
    } else if (c == PS2_PAGEDOWN) {
      Serial.print("[PgDn]");
    } else if (c == PS2_PAGEUP) {
      Serial.print("[PgUp]");
    } else if (c == PS2_LEFTARROW) {
      Serial.print("[Left]");
    } else if (c == PS2_RIGHTARROW) {
      Serial.print("[Right]");
    } else if (c == PS2_UPARROW) {
      Serial.print("[Up]");
    } else if (c == PS2_DOWNARROW) {
      Serial.print("[Down]");
    } else if (c == PS2_DELETE) {
      Serial.print("[Del]");
    } else {
     
      // otherwise, just print all normal characters
      Serial.print(c);
    }
  }
}

I have jumpers soldered to the PS/2 adapter.

When I scan the PS/2 Wired Connector P804 barcode I get this:
ob9cox.

If I scan the Barcode Reader/Scanner - PS/2 P1202 barcode that is on the box that the barcode/scanner came in I get this:
ob9,i

Am I doing something wrong or do I have a defective Barcode Reader/Scanner?

Please help, I have been waiting in a previous post that no one has replied to for almost a year now.
Thanks,

Kame77
 
Posts: 2
Joined: Thu Jan 21, 2016 11:00 pm

Please be positive and constructive with your questions and comments.