
Page 36 Model 801GC-ISA & 801GF-ISA Programming Manual
Type COMM_DATA_TYPE
portType As Integer ' 0-None, 1-ISA, 2-Com port
PortNum As Integer ' 0-7 ISA, 1-4 Com port
Baud As Integer ' Baud rate for the com port 300, 600 1200, 2400, 4800, 9600, 19200, 38400
Parity As Integer ' Parity for the com port 0=None(N), 1=Even(E), 2=Odd(O)
Data_Bits As Integer ' The number of Data Bits for the com port 7 or 8
Stop_Bits As Integer ' The number of Stop Bits for the com port 1 or 2
Handshake As Integer ' Handshaking for the com port 0=None(N), 1=Software(S)(RTS/CTS),
2=Hardware(H)(Xon/Xoff)
Protocol As Integer ' 0=None(N), 1=YMODEM(Y)
End Type
Global comm_data As COMM_DATA_TYPE 'Holds the data needed to control the communications interface
Global PortSpec As String 'String defining the port, e.i. 'isa0', 'com1'
Global Connected As Integer 'Flag to indicate communication status
Global response As String * 100 'Set response buffer size must be done before calling DLL
Global cmd As String 'String that holds the command that will be downloaded to generator
Global Answer As Integer 'The value returned by the generator containing the error response 0=No
Error
Declare Function port_open Lib "hia.dll" (ByVal PortSpec As String, comm_data As COMM_DATA_TYPE) As Integer
Declare Function port_command Lib "hia.dll" (comm_data As COMM_DATA_TYPE, ByVal cmd As String, ByVal
response As String) As Integer
Declare Function board_init Lib "hia.dll" (comm_data As COMM_DATA_TYPE, ByVal response As String) As Integer
Sub PortConnect_Error (Answer As Integer)
If Answer = PORT_OK Then
frmExample!pnlStatus.Caption = "Communication establish successfully. "
ElseIf Answer = PORTERROR_ISANUMBAD Then
MsgBox "Could not establish communication. Incorrect ISA port. Valid ISA ports are 0, 1, 2, 3, 4,
5, 6, or 7. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_ISAMISSING Then
MsgBox "Could not establish communication. ISA port hardware is missing. ", 16, "Communication
Error"
ElseIf Answer = PORTERROR_COMNUMBAD Then
MsgBox "Could not establish communication. Incorrect COM port. Valid COM ports are 1, 2, 3, or 4.",
16, "Communication Error"
ElseIf Answer = PORTERROR_COMMISSING Then
MsgBox "Could not establish communication. COM port hardware missing. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_NOCONNECT Then
MsgBox "Could not establish communication. Problem making connection. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_ECHOTIME Then
MsgBox "Could not establish communication. Abort - slow echo. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_ECHOCHAR Then
MsgBox "Could not establish communication. Abort - wrong char echoed. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_ECHOCMD Then
MsgBox "Could not establish communication. Abort - bad command echo. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_USERQUIT Then
MsgBox "Could not establish communication. Abort - user quit. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_CMDINVALID Then
MsgBox "Invalid command sent to the video generator. ", 16, "Communication Error"
ElseIf Answer = PORTERROR_EXEINVALID Then
MsgBox "Execution error. Could not execute the command downloaded.", 16, "Communication Error"
ElseIf Answer = PORTERROR_BUFFOVRFLOW Then
MsgBox "Could not establish communication. Abort - unknown port error.", 16, "Communication Error"
ElseIf Answer = PORTERROR_BOARDHUNG Then
MsgBox "Could not establish communication. ", 16, "Communication Error"
End If
End Sub
Kommentare zu diesen Handbüchern