Using the TL6 DLL

The TL6V2.dll file should be installed in the /WINDOWS/SYSTEM directory

It has three primary function calls and 2 new function calls

EnableBoth (Port,Coin1,Coin2,Coin3,Coin4,Coin5,Coin6,Note1,Note2,Note3,Note4) 
   This function opens the serial port and enable the coin and note validators.
   The DLL stores the values of all the coins and notes when this function is called.
   Function returns a 0 if sucessful and a -1 if there is an error.

EnableBoth2 (Port,Coin1,Coin2,Coin3,Coin4,Coin5,Coin6,Note1,Note2,Note3,Note4,Note5,Note6,Note7,Note8) 
   This function opens the serial port and enable the coin and note validators.
   The DLL stores the values of all the coins and notes when this function is called.
   Function returns a 0 if sucessful and a -1 if there is an error.



ReadValue ()
   This function returns the total value of all coins insterted into the validator since the last call.
   The function should return a -1 value on first calling only.
   If the function continually returns a -1 value the TL6 is not responding, check the port setting and connections.
   The function should be called between 1 and 10 times a second by your program to check for coins.

ReadValue2 ()
   This is the 8 note version of ReadValue
   This function returns the total value of all coins insterted into the validator since the last call.
   The function should return a -1 value on first calling only.
   If the function continually returns a -1 value the TL6 is not responding, check the port setting and connections.
   The function should be called between 1 and 10 times a second by your program to check for coins.



DisableTL6()
   This Function has no return value, it disables the coin and note validators and closes the port.
   Function MUST be called on exit of your program to avoid locking up the port.



These should be declared in a VB Module as follows.

Declare Function EnableBoth Lib "TL6.dll" (ByVal Port As Integer, ByVal Coin1 As Integer, ByVal Coin2 As Integer, ByVal Coin3 As Integer, ByVal Coin4 As Integer, ByVal Coin5 As Integer, ByVal Coin6 As Integer, ByVal Note1 As Integer, ByVal Note1 As Integer, ByVal Note2 As Integer, ByVal Note3 As Integer, ByVal Note4 As Integer) As Integer
Declare Function ReadValue Lib "TL6.dll" () As Integer
Declare Sub DisableTL6 Lib "TL6.dll" ()

Here's some examples of how to use the functions in VB.

Private Sub Form_Load()
 ( Other Form_Load Code )
If EnableBoth(Port, Coin1, Coin2, Coin3, Coin4, Coin5, Coin6, Note1, Note2, Note3, Note4) <> 0 Then
   Call MsgBox("Failed to open port", vbCritical, "Port Error")
   Exit Sub
   End If
End Sub

One easy way of checking the coin mechanism is to use a timer.

Private Sub Timer1_Timer()
Value = ReadValue
If Value = -1 Then Invalid = 1
If Value > 0 Then Credit = Credit + Value
End Sub


Private Sub Form_Terminate()
DisableTL6
 ( Other Form_Terminate Code )
End Sub


