|
Upstate
Networks Incorporated |
|
|
The PC2MDB™
PC2MDB allows the PC to act as a slave device for existing vending machine controllers (VMC). It allows the PC to act as a cashless device. The PC2MDB interfaces any MDB vending device to the PC via the serial port.. Perfect for PC interfaces to existing vending machines to allow the PC to control the vending machine.
TELEPHONE: (315)
732-5664
E-MAIL: info@upstatenetworks.com
Order:
http://www.upstatenetworks.com/web_order/order_main.php
Price: $399 each, $94.55 in quantity. Includes user's guide, hardware, USB and MDB cables, software and source code.
Important Note: We have had several recent communications from customers regarding the sequence of data transmissions between the VMC and the PC2MDB. To this end we have an Example1: that may be used with most VMCs. Example 2 for a Point of Sale system and Example 3 for a Universal Satellite Device
The latest version of PC2MDB™ User’s Guide, along with technical support and information about Upstate Networks, may be found on the Upstate Networks World-Wide Web server at http://www.upstatenetworks.com/pc2mdb.
The PC2MDB is a slave device for an already existing vending machine with a vending machine controller (VMC). It allows the PC to act as a cashless device and add credit(s) to the vending machine. Special versions allow the PC to act as a bill validator or coin acceptor/dispenser. By default the PC2MDB acts as device type 10 (cashless device)
This describes the Interface Protocol for the PC2MDB Hardware circuit. The PC2MDB™ interfaces any MDB vending device (6-pin molex/5pin MTA) to the PC via the serial port (DB-9) Future support may include Universal Serial Bus. The PC2MDB™ protocol is compatible with standard RS-232 Protocol.
PC2MDB™ requires:
An IBM PC compatible, with 486 or better
processor.
A serial COM port.
An MDB compatible
vending device
External
Power supply (Typically 24VDC)
DB-9
(F-M) cable and MDB cable

|
Switch # |
|
Function |
|
|
1 |
OFF |
Operational Mode |
|
|
ON |
Ignore DTR |
||
|
2 |
OFF |
5 Second Start-up delay |
|
|
ON |
250 mSec start-up delay |
||
|
3 |
OFF |
5 mSec Response time |
|
|
ON |
1 mSec Response time |
||
|
4 |
OFF |
440 uSec Inter-byte delay |
|
|
ON |
900 uSec Inter-byte delay |
||
|
|
|
|
|
|
LED DESIGNATION |
INDICATION |
|
D2 |
+5 VDC |
|
D3 |
TRANSMIT TO MDB |
|
D4 |
TRANSMIT TO PC |
|
PULSE OUTPUT |
|
JUMPERS |
INDICATION |
|
JMP1 |
MDB2PC RD |
|
JMP2 |
PC2MDB RD |
|
JMP3 |
MDB2PC TX |
|
JMP4 |
PC2MDB TX |
|
JMP5 |
Not used |
|
JMP6 |
PULSE OUTPUT |
|
JMP7 |
NOT IN WHEN JMP6 IS IN SPECIFICATIONS |
Power requirements
24
to 35 Vdc
90 ma Typical
300 ma Maximum
Environmental
Operating Temp 32°F to 158°F
0°C to 70°C
Storage Temp -22°F to 165°F
-30°C to 74°C
Relative Humidity 5% to 95% Non-condensing
Physical Weight
< 1 lb
Physical Dimensions
Length 4.0 inches Width 3.0 inches Height 1.1 inches
Connector Info
PWR
24-35V Pin 2 +24Vdc Nominal
Pin 4 Ground
MDB Pin
1 +24Vdc Nominal
Pin 2 Ground
Pin 3 N/C
Pin 4 MDB Receive Data
Pin 5 MDB Transmit Data
Pin 6 Common
RS-232 Pin 1 N/C
Pin 2 PC Transmit Data
Pin 3 PC Receive Data
Pin 4 DTR
Pin 5 Ground
Pin 6 N/C
Pin 7 N/C
Pin 8 CTS
Pin 9 N/C
LED/Jumper Designations
D2 +5Vdc
D3 MDB Activity
D4 PC Activity
D6 Pulse Output Activity
Switch 1: Mode Select 1
Switch 2: Mode Select 2

It is time to install the PC2MDB™ itself and move on to the testing phase. Installation is relatively simple; there are only three connections that must be made for full functioning of the device. There are connectors on the edge of the board. One cable plugs into a 24VDC power supply. The 6-pin Molex connects to the VMC. The final connector is a DB-9 and connects into the back of the computer. There should be an open port on the back of the computer labeled “SERIAL2” or “COM2.”
When the master/VMC has data to send we check the mode bit to differentiate between ADDRESS bytes and DATA bytes. The upper five bits (MSB) of the Address Byte are used for addressing. The lower three bits of the Address Byte contain peripheral specific commands. This will allow up to eight instructions to be embedded in the first byte of block.
The PC2MDB sends information generated by the VMC device directly to the PC via RS-232 serial communication. It responds to polls issued by the VMC. PC2MDB will ACK only the polls, and commands issued to correct addresses. The PC2MDB then forwards the commands to the PC. Once the data has been processed, the PC sends back another set of instructions to the PC2MDB, which forwards these instructions to the VMC only when desired poll/polls have been received. The information sent to the PC is send as bytes in hexadecimal. The first byte sent is the device ID. For example 30 XX means that a bill validator has sent information. Whereas 08 XX means that a coin mechanism has sent data. Consult your manual for commands specific to your MDB device. We have included command sets for various MDB devices in this document. Please note that all examples of source code are written in MS Visual Basic 5.0
Use an interrupt driven comm event on the appropriate port. Settings are 9600-8-1-None. Set the receive threshold to 1. Empty the contents of the receive buffer as soon as there is at least one character ready. See the sample source code provided on CD-ROM for an example.
************************************************************************************************
Case comEvReceive 'Received RThreshold # of Chars
Do While
comm_port.InBufferCount > 0
MDB2PC
_input$
= comm_port.Input
‘
MDB2PC
_input$
is the output of the MDB
to
the PC looking at the first five
‘characters
of MDB2PC
_input$
‘enables
the PC to determine current action of the MDB
.
To look at the first five
‘characters
of MDB2PC
_input$,
use Mid$(MDB2PC_input$, 1, 2)
b$ = Mid$(MDB2PC
_input$,
1, 5) ' shorthand for looking at the first 5 characters
'The following are the typical actions produced by
the MDB
If b$ = Mid$(MDB2PC
_input$,
1, 2) = 50 Then
Label3.Caption = "Nickel received"
nickins
= nickins + 1
RXSum = RXSum + 0.05
End If
***********************************************************************
Use an interrupt driven comm event on the appropriate port. Settings are 9600-8-1-None. Set the transmit threshold to 1. Send the address of the device followed by the command parameters.
***********************************************************************
Private Sub Command6_Click()
MDB_output_string
= Chr$(13) & Chr$(&H52) 'Dispense
Quarter
comm_port.DTREnable
= True
‘Start Handshaking
End Sub
Case
comEvCTS
'Change in the CTS line
' this is
the output routine for transmitting
' outbuffersize set to 32 bytes, SThreshold = 1
comm_port.Output = MDB
_output_string
comm_port.DTREnable = False
'END
transmit one character on change of CTS line
***********************************************************************
When the PC has data to send to a slave device the following is required for sending this data:
Notes: Place the string to be transmitted in a temporary variable and then place the temporary variable in the output buffer.
For example (2):
Private
Sub cmdDispenseNickel_Click()
On Error GoTo ErrorHandler
' Dispense a Nickel
MDB_output_string = Chr$(13) & Chr$(&H10)
comInterface.DTREnable = True
' Update the Activity Log
lstActionLog.AddItem "Dispense Nickel"
Exit
Sub
ErrorHandler:
Resume Next
End
Sub
Since
we have the contents to be transmitted in a temporary string (MDB_output_string)
and we ‘have set DTR high (comInterface.DTREnable = True) we now wait for a
comm. Event to be generated ‘namely a change in the CTS line
For Example(2&3):
Case comEvCTS
'Change in the CTS line
'this is the output routine for transmitting
'outbuffersize set to 32 bytes
comInterface.Output = MDB_output_string
'END transmit one character on change of CTS line
‘At
this point the data has been sent to the output buffer of the serial port UART.
By setting ‘the Send Threshold to 1 we fire a comm. Send event when
the entire contents of the output buffer ‘have been sent and set DTR low to
indicate that we have completed transmission.
For example(4)
Case
comEvSend 'There are SThreshold number of characters in thetransmit
buffer
comInterface.DTREnable = True
‘****************************************************************
Technical
Support
UNI offers technical support for PC2MDBÔ primarily by e-mail and at http://www.upstatenetworks.com