April 20th, 2012, 08:54 AM
3rd Party Hardware Communication With COM Port - Help Needed
I have a Dollar Bill Acceptor (DBA) that I need to "talk" to through Delphi and could use some help. A DBA is a device like you'd find on a coin changer, slot machine, or vending machine. You insert a $1, $5, $20, etc and the device validates the note and pulses credits to the listening hardware.
The DBA has a 9-pin connector. Pin 7 and 8 are 'Credit Relay' lines (7 is normally open and 8 is common). I've attached these two pins to a USB terminal block that acts as a keyboard such that when a dollar bill is inserted, Delphi 'sees' the '5' key pressed 4 times (4 pulses = 4 x 25 cents = $1). This part works perfectly.
The problem is that I need to turn off the DBA until the user of the software has 'logged on'. The money inserted will be 'deposited' into a specific user's account so it creates a problem if someone inserts $1 but doesn't have an account on the system as there is no way to spit the note back out on a failed logon.
The other pins on the DBA's 9-pin connector are: INHIBIT+, INHIBIT-, 120VAC, and Ground. 3 pins are not used. According to the DBA manufacturer, I need to use INHIBIT+ and INHIBIT- to turn note acceptance on and off. When a user successfully logs on, the DBA needs to accept notes. When a user logs off, the DBA needs to reject (inhibit) notes.
My thought is I need to "talk" to the DBA through the computer serial port. Assuming the COM port is a suitable solution, I have two questions: How do I use Delphi to send data/signal/whatever through the COM port to the DBA and what pins on the COM port are the right ones to use?
The COM port has 9-pins: Carrier Detect (CD - Incoming Signal), Receive Data (RXD - Incoming Signal), Transmit Data (TXD - Outgoing Signal), Data Terminal Ready (DTR - Outgoing Signal), System Ground (GND - Neutral Signal), Data Set Ready (DSR - Incoming Signal), Request to Send (RTS - Outgoing Signal), Clear to Send (CTS - Incoming Signal), and Ring Indicator (RI - Incoming Signal).
So, somehow I need Delphi to 'send' some kind of data/signal to either the INHIBIT+ or INHIBIT- pins on the DBA. I have the wiring harness needed to connect between the DBA connector and the COM port connector, I'm just not sure which pins to use on the COM port nor do I know exactly how and what data/signal to send from Delphi. Can anyone help me with this problem?
Additional Information: The DBA manual seems to indicate that I need to 'send' +5VDC to the INHIBIT- pin of the DBA.
If INHIBIT+ and INHIBIT- are separate pins, then looks like you can use RTS and DTR for each of them and manipulate them accordingly. If they are actually a same pin, looks like RTS is the better choice.
For serial port communication, in Delphi there is TComport library. Search sourceforge.net for the source code.
But your biggest problem is that RS232 (serial) uses voltage in the range of -12 to +12V. You have to address this in your wiring.