image

BA2PC™ 

Bill Acceptor to RS-232 Interface
Licensed under US Patent 5,822,215 for Public Access Internet Terminals

 Software Developer's Kit


 

Summary:

The BA2PC™ is an electronic circuit designed to interface a standard bill validator to any PC. Combined with free software foundations it provides a simple but elegant solution to the bill validator aspect of the public access PC platform. It uses a standard DB-9 serial port connector and connects to any standard 120v AC bill validator. We highly recommend Coinco brand bill validators. The BA2PC™ interface uses Digital Signal Processing to sample and validate the incoming dollar bill and then buffers the count freeing up system resources on the CPU.

Port Settings:  300, 8, 1, None

DTR set HIGH enables Bill Validator.  Low disables Bill Validator

Input String F8h to FEh indicates bill inserted.  One Character per one dollar, Five (5) chars for a $5 etc…

Visual Basic 4.0 Source code

Private Sub ba_port_OnComm()

    On Error Resume Next

    Select Case ba_port.CommEvent

    'Errors

            Case comBreak   'A Break was received
           
Case comDCTO    'CD timeout

            Case comCTSTO   'CTS timeout
            Case comDSRTO   'DSR timeout
            Case comFrame   'Framing error
            Case comOverrun 'Data Lost
            Case comRxOver  'Receive Buffer overflow
            Case comRxParity    'Parity Error
            Case comTxFull  'Transmit buffer full


    'Events
        Case comEvCD    'Change in the CD line
        Case comEvCTS   'Change in the CTS line
        Case comEvDSR   'Change in the DSR line
        Case comEvRing  'Change in the Ring indicator
        Case comEvReceive   'Received RThreshold # of Chars
            t$ = time$  'Determine time interval for value
            For j% = 1 To intervals
                If t$ < interval(j%).time Then
                    Exit For
                End If
            Next j%
            j% = j% - 1
            If j% < 1 Then
                j% = intervals
            End If
 

            Do While ba_port.InBufferCount > 0

                bill$ = ba_port.Input

                dollarsNow = 0

                For i% = 1 To Len(bill$)

                    b$ = Mid$(bill$, i%, 1)

                    If (b$ >= Chr$(&HF8)) And (b$ <= Chr$(&HFE)) Then

               Next

                Open App.Path & "\log.txt" For Append As #1

                Print #1, Date$, time$, "Dollars inserted:"; dollarsNow; " ";

                For i% = 1 To Len(bill$)

                    Print #1, Hex(Asc(Mid$(bill$, i%, 1)));

                Next

                Print #1, " "

                Close #1

            Loop

        Case comEvSend  'There are SThreshold number of characters in the transmit buffer

    End Select

End Sub


 

To turn the Bill acceptor on/off:

 

'Start accepting bills....

    ba_port.RTSEnable = True             'Turn on BA adapter circuit

    ba_port.DTREnable = True             'Turn on Bill Acceptor

    ba_port.PortOpen =  True           

    ba_port.PortOpen = False             'Turn off Bill Acceptor

 


 

QBASIC source code

OPEN "com1: 300, n, 8, 1,cd0,cs0,ds0,op0,rs,rb2048" FOR INPUT AS #1

OPEN "c:\uni\credit.dat" FOR OUTPUT AS #2

PRINT #2, 0

CLOSE #2

OPEN "c:\uni\credit.dat" FOR OUTPUT AS #2

delay = 0

 

COLOR 15, 1, 1

CLS

PRINT "       Please insert $1 for 10 minutes or $5 for an hour of

INTERNET"

PRINT

PRINT " When you are done inserting all of your bills, press any key to

continue..."

LOCATE 5, 35

PRINT "Credit: $"; credit

ON COM(1) GOSUB getbill

COM(1) ON

credit = 0

 

OUT &H3F8, 1

DO WHILE INKEY$ = ""

LOOP

 

OUT &H3F8, 0

REM PRINT "Total Credit: "; credit

PRINT #2, credit

CLOSE

REM DO WHILE INKEY$ = "": LOOP

REM stop

SYSTEM

 

getbill:

REM PRINT HEX$(ASC(INPUT$(1, 1)))

credit = credit + 1

LOCATE 5, 35

PRINT "Credit: $"; credit

RETURN

 




image
image