📄 pcgen.bas
字号:
Attribute VB_Name = "PCGEN"
Option Explicit
' ############################################################################
' The following list of constants is the set of possible return codes from all
' calls to this module. Of course, not all return codes will be returned by
' all calls, but the caller must be prepared to deal with the entire set.
'
Public Const GENI_NoError As Integer = 0
' Device is OK
Public Const GENI_NotOK As Integer = -1
' Device is not OK
Public Const GENI_Busy As Integer = -2
' Device is busy; command cannot be accepted
Public Const GENI_BadDeviceReference As Integer = -3
' Device not in [0..3]
Public Const GENI_BadOutputsControlRef As Integer = -4
' Outputs control not in [enabled, disabled]
Public Const GENI_BadBaudRateReference As Integer = -5
' Baud rate invalid
Public Const GENI_BadSBAReference As Integer = -6
' SBA not in [0..31]
Public Const GENI_BadCommandSyntax As Integer = -7
' Syntax error detected in command block
Public Const GENI_CommandProcessingError As Integer = -8
' Processing error encountered with command block
Public Const GENI_CommandTimeout As Integer = -9
' Timeout error declared during command processing
Public Const GENI_NoDevice As Integer = -10
' No device at SBA
Public Const GENI_InappropriateDevice As Integer = -11
' Device type not appropriate for request
Public Const GENI_BadReplyLength As Integer = -12
' Datagram reply length different than expected
Public Const GENI_BadCircuitReference As Integer = -13
' Circuit reference <1 or > maximum supported
Public Const GENI_IOTable_Lockout_Failure As Integer = -14
' I/O table lockout semaphore failure
Public Const GENI_OutputsNotEnabled As Integer = -15
' Outputs must be enabled to write to device
Public Const GENI_CannotEnableOutputs As Integer = -16
' Another controller already assigned to device
Public Const GENI_UnknownError As Integer = -99
' Unexpected error encountered
' ----------------------------------------------------------------------------
' ############################################################################
' The following list of constants is the set of possible model numbers for
' devices which may be encountered on the Genius bus.
'
'' Hand-held monitors
Public Const DevType_HHM_PhaseA As Integer = 2 ' [IC660HHM500]
Public Const DevType_HHM As Integer = 5 ' [IC660HHM501]
'' 8 circuit discrete blocks
Public Const DevType_Circ_8_115VAC_Grouped_PhaseA As Integer = 64 ' [IC660CBD100]
Public Const DevType_Circ_8_115VAC_125VDC_Isolated_PhaseA As Integer = 65 ' [IC660CBS100]
Public Const DevType_Circ_8_115VAC_2A_Grouped As Integer = 69 ' [IC660BBD100]
Public Const DevType_Circ_8_115VAC_125VDC_Isolated As Integer = 70 ' [IC660BBS100 / IC660BBS101]
Public Const DevType_Circ_8_220VAC_Grouped As Integer = 71 ' [IC660??????]
Public Const DevType_Circ_8_115VAC_LowLeakage_Grouped As Integer = 82 ' [IC660BBD101]
'' 16 circuit discrete blocks
Public Const DevType_Circ_16_24VDC_48VDC_Sink_PhaseA As Integer = 67 ' [IC660CBD021]
Public Const DevType_Circ_16_24VDC_48VDC_Source_PhaseA As Integer = 68 ' [IC660CBD020]
Public Const DevType_Circ_16_24VDC_48VDC_Sink As Integer = 72 ' [IC660BBD021 / IC660BBD023]
Public Const DevType_Circ_16_12VDC_24VDC_48VDC_Source As Integer = 73 ' [IC660BBD020 / IC660BBD022]
Public Const DevType_Circ_16_Normally_Open_Relay As Integer = 79 ' [IC660BBR101]
Public Const DevType_Circ_16_Normally_Closed_Relay As Integer = 80 ' [IC660BBR100]
Public Const DevType_Circ_16_115VAC_Input As Integer = 81 ' [IC660BBD110]
'' 32 circuit discrete blocks
Public Const DevType_Circ_32_5VDC_12VDC_24VDC_Sink As Integer = 74 ' [IC660BBD025]
Public Const DevType_Circ_32_12VDC_24VDC_Source As Integer = 75 ' [IC660BBD024]
'' 4 input / 2 output analog blocks
Public Const DevType_Voltage_Current_4in_2out_Analog_115VAC As Integer = 131 ' [IC660BBA100]
Public Const DevType_Voltage_Current_4in_2out_Analog_24VDC_48VDC As Integer = 132 ' [IC660BBA020]
Public Const DevType_Voltage_Current_4in_2out_Analog_115VAC_PhaseA As Integer = 128 ' [IC660CBA100]
Public Const DevType_Voltage_Current_4in_2out_Analog_24VDC_48VDC_PhaseA As Integer = 129 ' [IC660CBA020]
Public Const DevType_Current_Source_4in_2out_Analog_115VAC_125VDC As Integer = 140 ' [IC660BBA104]
Public Const DevType_Current_Source_4in_2out_Analog_24VDC_48VDC As Integer = 141 ' [IC660BBA024]
'' 6 output analog blocks
Public Const DevType_Current_Source_6out_Analog_115VAC_125VDC As Integer = 142 ' [IC660BBA105]
Public Const DevType_Current_Source_6out_Analog_24VDC_48VDC As Integer = 143 ' [IC660BBA025]
'' 6 input analog blocks
Public Const DevType_Current_Source_6in_Analog_115VAC_125VDC As Integer = 144 ' [IC660BBA106]
Public Const DevType_Current_Source_6in_Analog_24VDC_48VDC As Integer = 145 ' [IC660BBA026]
'' 6 input thermocouple blocks
Public Const DevType_6in_Thermocouple_115VAC_125VDC As Integer = 134 ' [IC660BBA103]
Public Const DevType_6in_Thermocouple_24VDC_48VDC As Integer = 135 ' [IC660BBA023]
'' 6 input RTD blocks
Public Const DevType_6in_RTD_115VAC_125VDC As Integer = 136 ' [IC660BBA101]
Public Const DevType_6in_RTD_24VDC_48VDC As Integer = 137 ' [IC660BBA021]
'' High speed counter (types A,B,C) block
Public Const DevType_High_Speed_Counter As Integer = 32 ' [IC660BBD120]
'' PowerTRAC block
Public Const DevType_PowerTRAC As Integer = 127 ' [IC660BPM100]
'' Series 6 Bus Controllers
Public Const DevType_Series_6_Bus_Controller_PhaseA As Integer = 1 ' [IC660CBB900]
Public Const DevType_Series_6_Bus_Controller_Wout_Diags_PhaseA As Integer = 3 ' [IC660CBB901]
Public Const DevType_Series_6_Bus_Controller As Integer = 6 ' [IC660CBB902]
Public Const DevType_Series_6_Bus_Controller_Wout_Diags As Integer = 7 ' [IC660CBB903]
'' Series 90 Bus Controllers
Public Const DevType_Series_9070_Bus_Controller As Integer = 10 ' [IC697BEM731]
Public Const DevType_Series_9030_Bus_Controller As Integer = 15 ' [IC693BEM331]
'' Series 90-70 Remote I/O Scanner
Public Const DevType_Series_9070_Remote_IO_Scanner As Integer = 160 ' [IC697BEM733]
'' Series 90-30 Global Data communications modules
Public Const DevType_Series_9030_Communications_Module As Integer = 13 ' [IC693CMM301]
Public Const DevType_Series_9030_Enhanced_Communications_Module As Integer = 14 ' [IC693CMM302]
'' Field Control Genius Bus Interface Unit
Public Const DevType_FieldControl_GBIU As Integer = 160 ' [IC670GBI001]
'' VersaMax Genius Bus Interface Unit
Public Const DevType_VersaMax_GBIU As Integer = 161 ' [IC200GBI001]
'' ISA-bus and PCI-bus GENI type devices
Public Const DevType_GENI As Integer = 4
'' [IC660ELB9xx]
' ----------------------------------------------------------------------------
' ############################################################################
' Caution: The following structure MUST be defined as byte-aligned, not word-
' aligned. The structure order cannot be altered.
'
' The GENI_SETUP structure defines the PCGEN setup structure portion of
' dual port RAM. It is exposed to the user for both read and write purposes.
' See GFK-0845, "Genius I/O Geni Board User's Manual" for details.
Public Type GENI_SETUP
configuration_register_settings As Byte
' SBA, baud rate, outputs disable
reference_address As Integer
' Reference address
broadcast_control_data_length As Byte
' Global data broadcast amount
directed_control_data_length As Byte
' Directed data amount accepted
io_buffer_length As Byte
' Size of (all) I/O buffers
reserved(10) As Byte
End Type
' ----------------------------------------------------------------------------
' ############################################################################
' Caution: The following structure MUST be defined as byte-aligned, not word-
' aligned. The structure order cannot be altered.
'
' The GENI_STATUS structure defines the PCGEN status structure portion of
' dual port RAM. It is exposed to the user for read purposes.
' See GFK-0845, "Genius I/O Geni Board User's Manual" for details.
Public Type GENI_STATUS
firmware_revision As Byte
' PCGEN firmware revision
ok_status As Byte
' Both board status & heartbeat indicator
hardware_status As Byte
' Error flags to explain "not ok" status
bus_status As Byte
' Warning flag for excessive bus errors
bus_error_count As Integer
' Total bus errors since PCGEN reset
bus_scan_time As Integer
' Time between last two bus cycles
reserved(8) As Byte
End Type
Public Const GENI_OK As Integer = 1
' Mask for OK bit in "ok_status"
' ----------------------------------------------------------------------------
' ############################################################################
' Caution: The following structure MUST be defined as byte-aligned, not word-
' aligned. The structure order cannot be altered.
'
' The DEVICE_CONFIG structure defines the makeup of each of 32 structures (one
' for each of 32 SBA's) in dual port RAM. It is exposed to the user for read
' purposes for the entire structure except "Outputs Enable", which is both read
' and write.
' See GFK-0845, "Genius I/O Geni Board User's Manual" for details.
Public Type DEVICE_CONFIG
model_number As Byte
' Device model number
outputs_disable As Byte
' Outputs disable for device
device_present As Byte
' Device present and logged in
reference_address As Integer
' Device reference address
broadcast_control_data_length As Byte
' Inputs / global data broadcast
directed_control_data_length As Byte
' Control data device expects
block_config As Byte
' Inputs only, outputs only or combo
End Type
' ----------------------------------------------------------------------------
' ############################################################################
' Caution: The following structure MUST be defined as byte-aligned, not word-
' aligned. The structure order cannot be altered.
'
' The REQUEST_Q_ENTRY structure is used in processing the receipt of memory
' access datagrams. It is not currently supported in this module...
' See GFK-0845, "Genius I/O Geni Board User's Manual" for details.
Public Type REQUEST_Q_ENTRY
COMMAND As Byte
status As Byte
data_length As Byte
host_memory_map(3) As Byte
source_device As Byte
aux_source_address As Byte
Data(128) As Byte
End Type
' ----------------------------------------------------------------------------
' ############################################################################
' The DEVICE_DATA structure defines the makeup of the I/O data for each of the
' possible Genius blocks.
'
' @@ ONLY DISCRETE blocks, 4IN/2OUT ANALOG BLOCKS and GENI-based device global
' data ARE CURRENTLY DEFINED HERE!!!!!
'
' See GFK-0845, "Genius I/O Geni Board User's Manual" for details.
'
' ANALOG_4IN_2OUT ' 4 input / 2 output analog blocks
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -