image

The MDB2USB™

Multi-drop bus (MDB) to USB 1.0 interface.  Allows a USB PC to control a dollar bill validator coin acceptor/dispenser , credit card, magnetic swipe and other cashless devices.  Perfect for PC controlled Kiosk requiring payment systems and PC based vending machines.  


Overview

The MDB2USB™ is a Computer Peripheral for interfacing vending machine protocol used by various devices including: Dollar Bill Validators, Coin Acceptors, Coin Dispensers, Smart Cards, Foreign Currency, etc. This describes the Interface Protocol for the MDB2USB Hardware circuit. The MDB2USB™ interfaces any MDB vending device (6-pin molex/5pin MTA) to the PC via the USB port. The MDB2USB™ protocol is compatible with standard USB 1.0 Protocol.

Quick Start

Install the MDB2usb™ on a free USB port.

 

Connect 24Vdc power and MDB connections (6-pin Molex).  Apply power.  Check for LED1 (Green) indicating power is OK.

 

Install and run HIDCOMM_B.EXE AND SETUP.EXE from the MDB2USB directory on Disk or CD-ROM provided.   Insert different dollar bill denominations, coins OR magnetic swipe, etc.  and check to see that they register in the MDB2USB™ or MDBlab program.  If all currency is registered the HARDWARE INSTALLATION is complete.  Proceed to SOFTWARE DEVELOPERS KIT.

Hardware Installation
Table 1 - Jumper functions

LED DESIGNATION

INDICATION

D1

+5 VDC

D2

TRANSMIT TO MDB

D3

TRANSMIT TO PC

Table 2 - LED Functions

Figure-2 Connector Pin Outs

Install the MDB2USB™

It is time to install the MDB2USB™ itself and move on to the testing phase.  Installation is relatively simple; there are only two connections that must be made for full functioning of the device.  There are connectors on the edge of the board.  The 6-pin Molex connects to the MDB devices. The final connector is a USB type A and connects into the back of the computer.  There should be an open port on the back of the computer labeled “USB”

 

 

Software and source code

Overview

'*****************************************************************

'*                                                               *

'*              MDB2USB Demonstration Software V1.0              *

'*                                                               *

'*  (c) Upstate Networks Inc                                     *

'*  1001 Broad Street Utica, NY 13501 USA                        *

'*  (315) 732-5664  info@upstatenetworks.com                     *

'*                       *

'*                                                               *

'*  Description                                                  *

'*  This program demonstrates transmit  and received to and from *

'*  a MDB device using USB.  The MDB protocol is used for payment*

'*  systems such as coinc mechs bill acceptors and card readers  *

'*                                                               *

'*  This appliction requires HIDcomm_B.oxc, the API for the USB  *

'*  written by Microchip.  *

'*                                                               *

'*  The top row of text are the transmit bytes and the bottom    *

'*  row are the receive byte.  Any data can be put in the send   *

'*  box SEND in DECIMAL                    .                     *

'*****************************************************************

 

Private Sub Command2_Click()

                                'DISPENSE QUARTER

    Dim buffer() As Byte        'define buffer to use for data

    ReDim buffer(8)             'send 8 bytes at a time

    Command2.Enabled = True     'disable send button until result received

    'On Error Resume Next       'trap errors if non numeric data in

                                'text box, or textbox empty

 

    buffer(0) = 3               '*********************************

    buffer(1) = 15              '*

    buffer(2) = 2               '*   DISPENSE Quarter

    buffer(3) = 5               '*   03 15 02 05 Hex

    buffer(4) = 0               '*   See MDB Spec for details

    buffer(5) = 0               '*   These values are in DECIMAL!

    buffer(6) = 0               '*

    buffer(7) = 0               '*********************************

 

HIDComm1.WriteTo buffer(), 8    'write data to MDB2USB

 

    Text1.Text = buffer(0)      '**** Update display *************

    Text2.Text = buffer(1)

    Text3.Text = buffer(2)

    Text4.Text = buffer(3)

    Text5.Text = buffer(4)

    Text6.Text = buffer(5)

    Text7.Text = buffer(6)

    Text8.Text = buffer(7)

 

End Sub

 

 

Private Sub Command1_Click()    'DISPENSE NICKEL

    Dim buffer() As Byte        'define buffer to use for data

    ReDim buffer(8)             'send 8 bytes at a time

    'On Error Resume Next       'trap errors if non numeric data in

                                'text box, or textbox empty

Command1.Enabled = True         'disable send button until result received

    buffer(0) = 3               '*********************************

    buffer(1) = 15              '*

    buffer(2) = 2               '*   DISPENSE Nickel

    buffer(3) = 1               '*   03 15 02 01 Hex

    buffer(4) = 0               '*   See MDB Spec for details

    buffer(5) = 0               '*

    buffer(6) = 0               '*

    buffer(7) = 0               '*********************************

 

HIDComm1.WriteTo buffer(), 8    'write data to MDB2USB

 

    Text1.Text = buffer(0)      '**** Update display *************

    Text2.Text = buffer(1)

    Text3.Text = buffer(2)

    Text4.Text = buffer(3)

    Text5.Text = buffer(4)

    Text6.Text = buffer(5)

    Text7.Text = buffer(6)

    Text8.Text = buffer(7)

 

 

 

End Sub

 

Private Sub Command3_Click()    'SEND BUTTON

    Dim buffer() As Byte        'define buffer to use for data

    ReDim buffer(8)             'send 8 bytes at a time

    'On Error Resume Next       'trap errors if non numeric data in

                                'text box, or textbox empty

    buffer(0) = Text1.Text      '***********************************

    buffer(1) = Text2.Text      '*

    buffer(2) = Text3.Text      '*  Send content of text boxes

    buffer(3) = Text4.Text      '*  to the MDB2USB

    buffer(4) = Text5.Text      '*  Put your transmit string here

    buffer(5) = Text6.Text      '*

    buffer(6) = Text7.Text      '*

    buffer(7) = Text8.Text      '***********************************

 

HIDComm1.WriteTo buffer(), 8    'write data to MDB2USB

 

End Sub

 

Private Sub End_Click()

    HIDComm1.Uninit             'disconnect from the USB device as prgoram ends

    End

End Sub

 

Private Sub Form_Load()

    HIDComm1.Connect            'connect to the USB device as the program starts

End Sub

 

Private Sub Form_Terminate()

    HIDComm1.Uninit             'disconnect from the USB device as prgoram ends

End Sub

 

Private Sub HIDComm1_ConnectSuccess(ByVal Status As Long)

                               

    Command1.Enabled = True     'enable button when device is connected

    Command2.Enabled = True     'enable button when device is connected

    Caption = "MDB2USB - Connected to MDB2USB HID Device"

 End Sub

 

Private Sub HIDComm1_Disconnected(ByVal Status As Long)

                              

    Command1.Enabled = False     'disable button when device unplugged

    Command2.Enabled = False     'disable button when device unplugged

    Caption = "MDB2USB - Looking for MDB2USB HID Device"

 End Sub

 

Private Sub Timer1_Timer()      'try and reconnect PIC

Dim buffer() As Byte            'define buffer to use for data

ReDim buffer(8)                 'send 8 bytes at a time

 

    If HIDComm1.Connected = False Then

        HIDComm1.Connect

    End If

End Sub

 

Private Sub Timer2_Timer()      '*****  READ MDB2USB *******

                                '**   Timer set for 1mSec **

Dim buffer() As Byte            'define buffer to use for data

ReDim buffer(8)                 'send 8 bytes at a time

 

    buffer(0) = 0               'Clear all buffers

    buffer(1) = 0

    buffer(2) = 0

    buffer(3) = 0

    buffer(4) = 0

    buffer(5) = 0

    buffer(6) = 0

    buffer(7) = 0

   

    buffer() = HIDComm1.ReadFrom(8) 'Read MDB2USB

 

    If buffer(0) = 0 Then Exit Sub  'No Data received --> EXIT

 

    Text9.Text = Chr((buffer(0)))   'Display data Received

    Text10.Text = Chr((buffer(1)))  '************************

    Text11.Text = Chr((buffer(2)))  '*

    Text12.Text = Chr((buffer(3)))  '* RECEIVE DATA HERE

    Text13.Text = Chr((buffer(4)))  '*

    Text14.Text = Chr((buffer(5)))  '*

    Text15.Text = Chr((buffer(6)))  '*

    Text16.Text = Chr((buffer(7)))  '************************

   

End Sub

'************************************************************

'*  END  END  END  END  END  END  END  END  END  END  END  **

'************************************************************

 

 

 




image
image