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.

<wta>Portable Barcode scanner project

Status
Not open for further replies.

myFYP

New Member
hi there,

i am doing my FYP as to build a portable barcode scanner. and i plan to modify a barcode scanner to interface to 18f452 Pic and display in lcd.

my problem is i cant even supply power to turn on my barcode scanner: the scanner i used has a ps2 connector and require a 5v Vcc and operating current 100mA. however, when i connect a 9v battery and with a 5v regulator to my scanner, it cant be turn on and the voltage across will decrease to less than 3v.

so i am suspecting the current supply doesnt enuf, so i connect a 5v adapter plug with 2A current to my scanner, it still cant be turn on.

and the only way to turn it on is by connecting it to cpu ps2 port. then it can turn on normally even i only connect two pin in the ps2 port which is Vcc and GND pin.

i believe if any other "portable" way to turn on a keyboard with ps2 port will jus be the same way to turn on a ps2 port barcode scanner other than connect to cpu.

anyone have any idea regarding this, pls, i am desperate for help and advises. tyvm

pls welcome to put in any related post's link regarding my project including programming discussion on barcode. tyvm
 
Assuming a known good scanner (which it should be since it works connected to a PS2 port) you have something wired wrong. Note the PS2 connector pinout. Note the pin count does not run cw or ccw around the connector. All the reader should require is 5 Volts on pins 3 & 4 to operate. Note how pins 3 & 4 oppose each other. Note the polarity 4 is + and 3 is common (GND.).

How do you plan to interface the bar code reader to the PIC?

Ron
 
Last edited:
holy goodness, i am stuck by that mistake for so long...now it can on by battery. tx bro. btw, i am goin to juz connect the data pin and clk pin to one of the i/o port in 18f452, and later receive the data in ascii form to process it and display in lcd..

anyone have any related project, software, useful link, or any related stuff, may welcome to put down.... i will always appreciate for any comments and wish that i can get thru my FYP smoothly. tyvm
 
wow. this sounds EXACTLY like my project. except i used a rs-232 connection to the pic and used the hardware usart, pins 25 and 26.
first thing to test, hook up the scanner to hyperterminal on the computer and see if u get the correct output. the ms 180 came with the end character as "\n", ie a new line. u could set this to be what u want.
once ure reading the correct input. ensure that u connect the scanner to the pic correctly. i used a max 232 to convert the voltage levels to TTL. if you are using polarised capacitors, ensure that its the correct orientation.
ensure that the transmit pin of the scanner, in my case it was pin 2 goes to the receive pin of the pic. nothing goes back to the scanner, unless u have cts/rts handshaking. either way connect it correctly.
this is the code i used. i used it to scan id's which were send char by char and stored in the variable ID_SEND.

Code:
void read_scanner (void)
{
  char ID_SEND[15];    				
  unsigned int i=0 ;
		
		
  for(i=0; i<10; i++) ID_SEND[i] = 0;
  i=0;
  do {			
	  while (!DataRdyUSART());
	  ID_SEND[i] = getcUSART();
	  i++;
  } 
  while ((ID_SEND[i-1] != '/n') && (i<15));    //searches for end of barcode, ie. newline
				             
}


i am not too familar with mikroC, but it has a lot of easier functions to use, compared with the C-18 library.
 
Status
Not open for further replies.

Latest threads

Back
Top