PC Controlled Vending Since

  1994

Upstate Networks Incorporated

MDB, USB, RS-232, Bill, Coin, & Magnetic swipe hardware for PC vending machine controllers

 


[ Home ]  [ About ] [ Order ]  [ Products ] [ Support ]  [ News ] [ Customer Care ]  [ Contact ]
New Zealand and Australian agent - Steward Electronics Ltd

 

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. 

The PC2MDB™ is available in several different packages to meet the needs of developers and vending machine owners. Find out which package best meets your needs here


Overview

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.

For the most current PC2MDB User Guide please click here

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

 

 

 

 

Table 1 – Dip Switch Functions

LED DESIGNATION

INDICATION

D2

+5 VDC

D3

TRANSMIT TO MDB

D4

TRANSMIT TO PC

D5

PULSE OUTPUT

Table 2 - LED Functions

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 3.5 inches Width 2.4 inches Height 1.5 inches
Mounting Template
Click here for template
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

Figure-2 Connector Pin Outs

Install the PC2MDB

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.”

Software

Overview

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

 

MDB2PC Software Communication

 

Receive 

  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 XE "MDB2PC" _input$ = comm_port.Input

‘ MDB2PC XE "MDB2PC" _input$ is the output of the MDB XE "MDB"  to the PC looking at the first five

‘characters of MDB2PC XE "MDB2PC" _input$

‘enables the PC to determine current action of the MDB XE "MDB" .  To look at the first five

‘characters of MDB2PC XE "MDB2PC" _input$, use Mid$(MDB2PC_input$, 1, 2)

               

           b$ = Mid$(MDB2PC XE "MDB2PC" _input$, 1, 5) ' shorthand for looking at the first 5 characters

              'The following are the typical actions produced by the MDB XE "MDB"

           If b$ = Mid$(MDB2PC XE "MDB2PC" _input$, 1, 2) = 50 Then

               Label3.Caption = "Nickel received"

nickins = nickins + 1

               RXSum = RXSum + 0.05

           End If

***********************************************************************

Transmit

  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 XE "Dispense"  Quarter

comm_port.DTREnable = True                ‘Start Handshaking XE "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 XE "MDB" _output_string

       comm_port.DTREnable = False

'END transmit one character on change of CTS line

***********************************************************************

 

Handshaking XE "Handshaking"

When the PC has data to send to a slave device the following is required for sending this data:

 

  • Send DTR high (DTR.Enabled=TRUE)
  • On Change in CTS line (generated by the VMC) set output buffer=string to be transmitted
  • Place contents of string in output buffer and transmit
  • Set DTR low after transmitting entire string

 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

‘****************************************************************

 


[ Home ]  [ About ] [ Order ]  [ Products ] [ Support ]  [ News ]  [ Customer Care ]  [ Contact ]

©Copyright 2008 Upstate Networks Inc. All Rights Reserved
For more information Contact Us
The CashCube™, MDB2PC, BA2PC, and MDB2USB are trademarks of Upstate Networks, Inc.
Other product names and various content (including but not limited to audio, video,
and graphics) are trademarks of Upstate Networks.