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.

Need Help Interfacing RS232 Devices to a PIC

Status
Not open for further replies.

krusty50

New Member
***Long post ahead :p Sorry for possible English mistakes, it ain't my mother tongue ;)***

Hi guys, my name's Steve and I'm currently finishing my formation in Tech. EE here in Canada.

**Background info***
I'm currently doing my final project with my partner and we've encountered some problems we can't resolve so I decided to try the forums since I know there are very knowledgeable people here ;)

Our project is a basic liquor inventory system for bars/restaurants. A waitress would take an inventory reading of their bottles (26oz/40oz mainly) of hard alcohol/liquor at the begining of her work shift then take one at the end to know wich quantity of alcohol was sold during the night.

Here's how it should work

First you identify the bottle using a bar-code scanner and some pre-applied bar codes sticker. The data sent by the bar-code scanner (a ps/2 modified cuecat) is sent into the pic (P16F877) who selects the good bottle (we need to do this cause each alcohol has a different volumic mass when weighted). We then drop the bottle on our RS232-enabled scale (Acculab VIR-4KG) wich sends the weight into the pic. This weight is transformed into ounces using a pre-calculated algebric transformation stored inside the pic. The result is then displayed on an alphanumeric LCD.


And now here's the problem :p Our knowledge of the RS232 interface is somewhat limited and for various reasons we don't wanna rely too much on our teachers so I'm hoping some people can help us here.

We tried hooking up the bar-code scanner to a logic analyser to see what kind of data stream we always got random strings of data. Were guessing it's because we left the CLK pin floating ... I looked around the net and couldn't find anything about it.

What should I input into this pin? It usually comes from the computer so I'm guessing a square wave signal at a specific frequency?

If anyone has other comments regarding the subject feel free to post :)

Thanks,
Steve
 
As you said the barcode scanner is a "modifed PS-2 cuecat". If it is using a PS-2 interface then that is not RS-232. My guess is the barcode scanner is inserted betwwen the PS-2 keyboard and the PC PS-2 keyboard jack. You can try googling for PS-2 keyboard interface timings. Keywords would be "PIC PS-2 interface".

Or try this link:
**broken link removed**

You also mentioned an RS-232 enabled scale. Do you mean you need two interfaces on the PIC? One is RS-232 and the other PS-2.
 
motion said:
As you said the barcode scanner is a "modifed PS-2 cuecat". If it is using a PS-2 interface then that is not RS-232. My guess is the barcode scanner is inserted betwwen the PS-2 keyboard and the PC PS-2 keyboard jack. You can try googling for PS-2 keyboard interface timings. Keywords would be "PIC PS-2 interface".

Or try this link:
**broken link removed**

You also mentioned an RS-232 enabled scale. Do you mean you need two interfaces on the PIC? One is RS-232 and the other PS-2.

The magazine EPE published an article about PS2 interfacing to a PIC, followed by a game, you can download the software at **broken link removed**.

Basically it's a syncronous serial protocol, with start bit, 8 data bits, parity bit, and stop bit. It also has the possibility of being bi-directional, so you can write to the keyboard - the EPE code is only one way though.
 
Yeah sorry had a mind fart :p The scale is using a RS-232 interface while the cuecat is PS/2.

Anyway thanks for the links, I'll check them out and update in the upcoming days if all goes well.

Thanks :)
 
krusty50 said:
Yeah sorry had a mind fart :p The scale is using a RS-232 interface while the cuecat is PS/2.

Anyway thanks for the links, I'll check them out and update in the upcoming days if all goes well.

For RS232 you can check my tutorials, it's simple to do, either in software or using the PIC hardware USART.
 
Status
Not open for further replies.

Latest threads

Back
Top