Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 17th January 2005, 03:05 AM   (permalink)
Default Need Help Interfacing RS232 Devices to a PIC

***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
krusty50 is offline   Reply With Quote
Old 17th January 2005, 03:36 AM   (permalink)
Default

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:
http://panda.cs.ndsu.nodak.edu/~acha...ro/PS2/ps2.htm

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.
__________________
"Having to do with Motion Control"
motion is offline   Reply With Quote
Old 17th January 2005, 05:46 AM   (permalink)
Default

Quote:
Originally Posted by motion
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:
http://panda.cs.ndsu.nodak.edu/~acha...ro/PS2/ps2.htm

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 ftp://ftp.epemag.wimborne.co.uk/pub/PICS/AlphaMouse/.

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 17th January 2005, 03:47 PM   (permalink)
Default

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 is offline   Reply With Quote
Old 17th January 2005, 04:54 PM   (permalink)
Default

Quote:
Originally Posted by krusty50
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 10:46 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.