Attribute VB_Name = "TUSBKDIO"
'-----------------------------------------------
'API for TUSB-K16DIO Driver
'Visual Basic 6 Module
'
'Oct. 31 2006
'Copyright (C) 2006 Turtle Industry Co.,Ltd.
'-----------------------------------------------

'API Function declaration

Declare Function TUSBK16DIO_Dir Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByVal Port As Byte, ByVal Dir As Byte) As Integer
Declare Function TUSBK16DIO_PortWrite Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByVal Port As Byte, ByVal data As Byte) As Integer
Declare Function TUSBK16DIO_Write Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByVal Data1 As Byte, ByVal Data2 As Byte) As Integer
Declare Function TUSBK16DIO_Read Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByRef Data1 As Byte, ByRef Data2 As Byte) As Integer
Declare Function TUSBK16DIO_DirRead Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByRef Dir1 As Byte, ByRef Dir2 As Byte) As Integer
Declare Function TUSBK16DIO_OutputRead Lib "TUSBKDIO.DLL" (ByVal Id As Integer, ByRef Data1 As Byte, ByRef Data2 As Byte) As Integer
Declare Function TUSBK16DIO_Chk Lib "TUSBKDIO.DLL" (ByVal Id As Integer) As Integer
Declare Sub TUSBK16DIO_Load Lib "TUSBKDIO.DLL" ()
Declare Sub TUSBK16DIO_Unload Lib "TUSBKDIO.DLL" ()

' Error Message
Public Function TUSBK02AD_ErrorDisp(ByVal ErrCode As Integer)
    Dim str As String
    
    Select Case ErrCode
    Case 0
        str = "正常に終了しました"
    Case 2
        str = "ドライバが初期化されていません"
    Case 6
        str = "デバイスが見つかりませんでした"
    Case 8
        str = "パラメータエラー"
    Case 9
        str = "USB通信エラー"
    Case Default
        str = "不明なエラーです"
    End Select
    
    MsgBox (str)
End Function

