📄 pcgen.bas
字号:
' analog_inputs(4) As Integer
' analog_outputs(2) As Integer
'
' @@Was a C++ Union
' discrete_blocks(4) As Byte ' 8, 16 & 32 circuit discrete blocks
' Analog4In2Out As ANALOG_4IN_2OUT ' 4 input / 2 output analog blocks (Was a C++ type struct and Union)
' broadcast_global_data(128) As Byte ' input from global data producing device
' directed_control_data(128) As Byte ' directed control inputs in PCI Genius card
' Only care about global data in this application so that's all I defined. If anything else is desired
' then just define it and convert the format to or dump the format into the 128 bytes defined.
' 128 Bytes is the maximum, but memory allocation must be 128 bytes irregardless of what is needed.
Public Type DEVICE_DATA
block_type As Byte
' discrete_blocks(4) As Byte ' 8, 16 & 32 circuit discrete blocks
' Analog4In2Out As ANALOG_4IN_2OUT ' 4 input / 2 output analog blocks
broadcast_global_data(128) As Byte
' input from global data producing device
' directed_control_data(128) As Byte ' directed control inputs in PCI Genius card
End Type
' ----------------------------------------------------------------------------
' ############################################################################
' The following set of structures defines the makeup of the configuraton data
' for each of the possible Genius blocks.
'
' *IO_CONFIG
' +GENERIC_DISCRETE_CONFIG
' +C16_115VAC_INPUT_CONFIG
' +ANALOG_4IN_2OUT_CONFIG
' oINPUT_CHANNEL_CONFIG
' oOUTPUT_CHANNEL_CONFIG
'
' @@ ONLY DISCRETE AND 4IN/2OUT ANALOG BLOCKS ARE CURRENTLY DEFINED HERE!!!!!
'
' See GEK-90486F-1, "Genius I/O System and Communications User's Manual" for details.
Public Type GENERIC_DISCRETE_CONFIG ' 8, 16 & 32 circuit in/out discrete blocks
circuit_config(32) As Byte
' Circuit configuration, 1 byte per circuit
End Type
Public Type C16_115VAC_INPUT_CONFIG ' 16 circuit input discrete block
circuit_config(16) As Byte
' Circuit configuration, 1 byte per circuit
points_1to8_input_filter_time As Byte
' Input filter time, circuits 1-8
points_9to16_input_filter_time As Byte
' Input filter time, circuits 9-16
points_1to8_open_off_threshold As Byte
' Open-off threshold, circuits 1-8
points_1to8_on_off_threshold As Byte
' On-off threshold, circuits 1-8
points_9to16_open_off_threshold As Byte
' Open-off threshold, circuits 9-16
points_9to16_on_off_threshold As Byte
' On-off threshold, circuits 9-16
End Type
Public Type INPUT_CHANNEL_CONFIG
circuit_configuration As Integer
' Circuit configuration, 2 bytes per channel
high_alarm As Integer
' High alarm
low_alarm As Integer
' Low alarm
high_scaling_point_eu As Integer
' High scaling point, engineering units
high_scaling_point_counts As Integer
' High scaling point, counts
low_scaling_point_eu As Integer
' Low scaling point, engineering units
low_scaling_point_counts As Integer
' Low scaling point, counts
End Type
Public Type OUTPUT_CHANNEL_CONFIG
circuit_configuration As Integer
' Circuit configuration, 2 bytes per channel
default_value As Integer
' Default value
high_scaling_point_eu As Integer
' High scaling point, engineering units
high_scaling_point_counts As Integer
' High scaling point, counts
low_scaling_point_eu As Integer
' Low scaling point, engineering units
low_scaling_point_counts As Integer
' Low scaling point, counts
End Type
Public Type ANALOG_4IN_2OUT_CONFIG
input_channels(4) As INPUT_CHANNEL_CONFIG ' Input channels 1-4
output_channels(2) As OUTPUT_CHANNEL_CONFIG ' Output channels 1-2
End Type
' @@Was a C++ Union
' discrete_io_config As GENERIC_DISCRETE_CONFIG
' c16_115vac_input_conf As C16_115VAC_INPUT_CONFIG
' analog_4in_2out_conf As ANALOG_4IN_2OUT_CONFIG
' Only care about global data in this application so that's all I defined. If anything else is desired
' then just define it and convert the format to or dump the format into the 32 bytes defined.
' 32 Bytes is the maximum, but memory allocation must be 32 bytes irregardless of what is needed.
Public Type IO_CONFIG
block_type As Byte
' Device block type
firmware_revision As Byte
' Block firmware revision
block_config_1 As Byte
' Block configuration, byte 1
block_config_2 As Byte
' Block configuration, byte 2
discrete_io_config As GENERIC_DISCRETE_CONFIG
' c16_115vac_input_conf As C16_115VAC_INPUT_CONFIG
' analog_4in_2out_conf As ANALOG_4IN_2OUT_CONFIG
End Type
' ----------------------------------------------------------------------------
' ############################################################################
' The following masks and values are useful for decoding configuration bytes
' returned in an IO_CONFIG structure. The mask should be applied first on the
' configuration byte, then a comparision made for a particular value.
'
' *** Discrete input/output block, block configuration byte # 1***
' ***************************************************************************
Public Const PulseTestMask As Integer = &H1
' Pulse Test: disabled/not disabled
''Public Const PT_Enabled As Integer = &H0
''Public Const PT_Disabled As Integer = &H1
Public Const FilterTimeMask As Integer = &H3C
' Input filter time
''Public Const FilterTimeRightShift As Integer = 2
Public Const ConfigProtectMask As Integer = &H40
' Configuration Protected: protected/not protected
''Public Const Cfg_Protected As Integer = &H40
''Public Const Cfg_NotProtected As Integer = &H0
Public Const ACDCMask As Integer = &H80
' AC/DC Selected: AC/DC
''Public Const AC As Integer = &H80
''Public Const DC As Integer = &H0
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' *** Discrete input/output block, block configuration byte # 2***
Public Const DuplexStateMask As Integer = &H1
' Duplex Default State: off/on
''Public Const DS_Off As Integer = &H0
''Public Const DS_On As Integer = &H1
Public Const OutputDefaultMask As Integer = &H2
' Output Default Time: 2.5sec/10sec
''Public Const OD_2p5s As Integer = &H0
''Public Const OD_10s As Integer = &H2
Public Const CPURedundancyMask As Integer = &HC
' Redundancy: none/HSB/duplex/GMR
''Public Const CPURedundancy_None As Integer = &H0
''Public Const CPURedundancy_HS As Integer = &H4
''Public Const CPURedundancy_Duplex As Integer = &H8
''Public Const CPURedundancy_GMR As Integer = &HC
Public Const BSMPresentMask As Integer = &H10
' BSM Present: absent/present
''Public Const BP_Absent As Integer = &H0
''Public Const BP_Present As Integer = &H10
Public Const BSMControllerMask As Integer = &H20
' BSM Controller: yes/no
''Public Const BSM_Ctr_No As Integer = &H0
''Public Const BSM_Ctr_Yes As Integer = &H20
Public Const BSMStateMask As Integer = &H40
' BSM Actual State: BusA/BusB
''Public Const BSM_BusA As Integer = &H0
''Public Const BSM_BusB As Integer = &H40
Public Const BSMForcedMask As Integer = &H80
' BSM Forced: forced/unforced
''Public Const BSM_NoForce As Integer = &H0
''Public Const BSM_Force As Integer = &H80
' ***************************************************************************
' *** Discrete input/output block, circuit configuration byte ***
Public Const CircuitTypeMask As Integer = &H3
' Circuit type: Tri-state/input/output
''Public Const TriStateInputValue As Integer = &H0
''Public Const InputValue As Integer = &H1
''Public Const OutputValue As Integer = &H2
Public Const OverloadShutdownMask As Integer = &H4
' Output overload shutdown: enabled/disabled
''Public Const OS_Enabled As Integer = &H0
''Public Const OS_Disabled As Integer = &H4
Public Const HoldLastStateMask As Integer = &H8
' Output hold last state: default/last
''Public Const OutputDefault As Integer = &H0
''Public Const OutputHoldLastState As Integer = &H8
Public Const OutputDefaultStateMask As Integer = &H10
' Output default state: on/off
''Public Const OutputOff As Integer = &H0
''Public Const OutputOn As Integer = &H10
Public Const NoLoadDetectionMask As Integer = &H20
' Output no load detection
''Public Const NL_Enabled As Integer = &H0
''Public Const NL_Disabled As Integer = &H20
Public Const PointForcedMask As Integer = &H40
' Circuit forced: yes/no
''Public Const PF_No As Integer = &H0
''Public Const PF_Yes As Integer = &H40
Public Const ReportFaultsMask As Integer = &H80
' Circuit report faults: yes/no
''Public Const RF_Yes As Integer = &H0
''Public Const RF_No As Integer = &H80
Public Const VCMask As Integer = &H7
' Voltage/Current Mask
Public Const InputModeMask As Integer = &H10
' Input mode: normal/alarm input
''Public Const IM_Normal As Integer = &H0
''Public Const IM_Alarm As Integer = &H10
Public Const ChannelActiveMask As Integer = &H20
' Channel active: yes/no
''Public Const CA_Active As Integer = &H0
''Public Const CA_Inactive As Integer = &H20
''Public Const VoltageFilterTimeMask As Integer = &HF
Public Const FeedbackTestingMask As Integer = &H8
' Feedback testing: enabled/disabled
''Public Const FT_Enabled As Integer = &H8
''Public Const FT_Disabled As Integer = &H0
Public Const MAX_CARDS_SUPPORTED As Integer = 4
' PCGEN driver can support up to 4 cards
' ############################################################################
' Enumeration used to set PCGEN card outputs as either "enabled" or "disabled"
' during a call to some of the class contructors or to the CardSetup function.
Public Enum GENI_Outputs
OutputsEnabled = &H0 ' Outputs enabled for all bus devices
Outputsdisabled = &H80 ' Outputs disabled for all bus devices
End Enum
#If False Then 'Trick preserves Case of Enums when typing in IDE
Public OutputsEnabled, Outputsdisabled
#End If
' Enumeration used to set PCGEN card bus baud rate during a call to some of
' the class contructors or to the CardSetup function.
Public Enum GENI_BaudRate
Baud_153p6kEXT = &H0 ' 153.6k extended
Baud_38p4k = &H20 ' 38.4k
Baud_76p8k = &H40 ' 76.8k
baud_153p6kstd = &H60 ' 153.6k standard
End Enum
#If False Then 'Trick preserves Case of Enums when typing in IDE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -