⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 declarations.vb

📁 汽车领can总线通讯程序
💻 VB
📖 第 1 页 / 共 2 页
字号:
	Structure s_xl_channel_config
		'<FieldOffset(0)> Public name As String		'32
		<FieldOffset(0)> Public name_b0 As Byte
		<FieldOffset(1)> Public name_b1 As Byte
		<FieldOffset(2)> Public name_b2 As Byte
		<FieldOffset(3)> Public name_b3 As Byte
		<FieldOffset(4)> Public name_b4 As Byte
		<FieldOffset(5)> Public name_b5 As Byte
		<FieldOffset(6)> Public name_b6 As Byte
		<FieldOffset(7)> Public name_b7 As Byte
		<FieldOffset(8)> Public name_b8 As Byte
		<FieldOffset(9)> Public name_b9 As Byte
		<FieldOffset(10)> Public name_b10 As Byte
		<FieldOffset(11)> Public name_b11 As Byte
		<FieldOffset(12)> Public name_b12 As Byte
		<FieldOffset(13)> Public name_b13 As Byte
		<FieldOffset(14)> Public name_b14 As Byte
		<FieldOffset(15)> Public name_b15 As Byte
		<FieldOffset(16)> Public name_b16 As Byte
		<FieldOffset(17)> Public name_b17 As Byte
		<FieldOffset(18)> Public name_b18 As Byte
		<FieldOffset(19)> Public name_b19 As Byte
		<FieldOffset(20)> Public name_b20 As Byte
		<FieldOffset(21)> Public name_b21 As Byte
		<FieldOffset(22)> Public name_b22 As Byte
		<FieldOffset(23)> Public name_b23 As Byte
		<FieldOffset(24)> Public name_b24 As Byte
		<FieldOffset(25)> Public name_b25 As Byte
		<FieldOffset(26)> Public name_b26 As Byte
		<FieldOffset(27)> Public name_b27 As Byte
		<FieldOffset(28)> Public name_b28 As Byte
		<FieldOffset(29)> Public name_b29 As Byte
		<FieldOffset(30)> Public name_b30 As Byte
		<FieldOffset(31)> Public name_b31 As Byte
		<FieldOffset(32)> Public hwType As Byte		'1
		<FieldOffset(33)> Public hwIndex As Byte		'1
		<FieldOffset(34)> Public hwChannel As Byte		 '1
		<FieldOffset(35)> Public transceiverType As UInt16		 '2
		<FieldOffset(37)> Public transceiverState As UInt32		 '4
		<FieldOffset(41)> Public channelIndex As Byte		 '1
		<FieldOffset(42)> Public channelMask As UInt64		 '8
		<FieldOffset(50)> Public channelCapabilities As UInt32		 '4
		<FieldOffset(54)> Public channelBusCapabilities As UInt32		 '4
		'channel
		<FieldOffset(58)> Public isOnBus As Byte		 '1
		<FieldOffset(59)> Public connectedBusType As UInt32		 '4
		<FieldOffset(63)> Public busParams As s_xl_busParams		 '36

		<FieldOffset(99)> Public driverVersion As UInt32		 '4
		<FieldOffset(103)> Public interfaceVersion As UInt32		 '4
		<FieldOffset(107)> Public raw_data0 As UInt32		 '4
    <FieldOffset(111)> Public raw_data1 As UInt32 '4
    <FieldOffset(115)> Public raw_data2 As UInt32 '4
    <FieldOffset(119)> Public raw_data3 As UInt32 '4
    <FieldOffset(123)> Public raw_data4 As UInt32 '4
    <FieldOffset(127)> Public raw_data5 As UInt32 '4
    <FieldOffset(131)> Public raw_data6 As UInt32 '4
    <FieldOffset(135)> Public raw_data7 As UInt32 '4
    <FieldOffset(139)> Public raw_data8 As UInt32 '4
    <FieldOffset(143)> Public raw_data9 As UInt32 '4

    <FieldOffset(147)> Public serialNumber As UInt32 '4
    <FieldOffset(151)> Public articleNumber As UInt32 '4

    <FieldOffset(155)> Public t0 As UInt32 '4
    <FieldOffset(159)> Public t1 As UInt32 '4
    <FieldOffset(163)> Public t2 As UInt32 '4
    <FieldOffset(167)> Public t3 As UInt32 '4
    <FieldOffset(171)> Public t4 As UInt32 '4
    <FieldOffset(175)> Public t5 As UInt32 '4
    <FieldOffset(179)> Public t6 As UInt32 '4
    <FieldOffset(183)> Public t7 As UInt32 '4

		'		<FieldOffset(164)> Public transceiverName As String		'32

    <FieldOffset(187)> Public reserved0 As UInt32 '4
    <FieldOffset(191)> Public reserved1 As UInt32 '4
    <FieldOffset(195)> Public reserved2 As UInt32 '4
    <FieldOffset(199)> Public reserved3 As UInt32 '4
    <FieldOffset(203)> Public reserved4 As UInt32 '4
    <FieldOffset(207)> Public reserved5 As UInt32 '4
    <FieldOffset(211)> Public reserved6 As UInt32 '4
    <FieldOffset(215)> Public reserved7 As UInt32 '4
    <FieldOffset(219)> Public reserved8 As UInt32 '4
    <FieldOffset(223)> Public reserved9 As UInt32 '4 sum: 227		
    Sub GetName()
			Dim name(32) As String
			For i As Byte = 0 To 31

			Next
		End Sub
	End Structure

	<StructLayout(LayoutKind.Explicit, Size:=36)> _
	Structure s_xl_busParams
		<FieldOffset(0)> Public busType As UInt32		 '4
		<FieldOffset(4)> Public data As s_xl_UnionBusParams		 '32 sum:36
	End Structure

	<StructLayout(LayoutKind.Explicit, Size:=32)> _
	 Structure s_xl_UnionBusParams
		<FieldOffset(0)> Public can As s_xl_can		 '9 
		<FieldOffset(0)> Public raw0 As Byte		'1
		<FieldOffset(1)> Public raw1 As Byte		'1
		<FieldOffset(2)> Public raw2 As Byte		'1
		<FieldOffset(3)> Public raw3 As Byte		'1
		<FieldOffset(4)> Public raw4 As Byte		'1
		<FieldOffset(5)> Public raw5 As Byte		'1
		<FieldOffset(6)> Public raw6 As Byte		'1
		<FieldOffset(7)> Public raw7 As Byte		'1
		<FieldOffset(8)> Public raw8 As Byte		'1
		<FieldOffset(9)> Public raw9 As Byte		'1
		<FieldOffset(10)> Public raw10 As Byte		'1
		<FieldOffset(11)> Public raw11 As Byte		'1
		<FieldOffset(12)> Public raw12 As Byte		'1
		<FieldOffset(13)> Public raw13 As Byte		'1
		<FieldOffset(14)> Public raw14 As Byte		'1	 
		<FieldOffset(15)> Public raw15 As Byte		'1
		<FieldOffset(16)> Public raw16 As Byte		'1
		<FieldOffset(17)> Public raw17 As Byte		'1
		<FieldOffset(18)> Public raw18 As Byte		'1
		<FieldOffset(19)> Public raw19 As Byte		'1
		<FieldOffset(20)> Public raw20 As Byte		'1
		<FieldOffset(21)> Public raw21 As Byte		'1
		<FieldOffset(22)> Public raw22 As Byte		'1
		<FieldOffset(23)> Public raw23 As Byte		'1
		<FieldOffset(24)> Public raw24 As Byte		'1
		<FieldOffset(25)> Public raw25 As Byte		'1
		<FieldOffset(26)> Public raw26 As Byte		'1
		<FieldOffset(27)> Public raw27 As Byte		'1
		<FieldOffset(28)> Public raw28 As Byte		'1
		<FieldOffset(29)> Public raw29 As Byte		'1
		<FieldOffset(30)> Public raw30 As Byte		'1
		<FieldOffset(31)> Public raw31 As Byte		'1	 sum:32
	End Structure

	<StructLayout(LayoutKind.Explicit, Size:=9)> _
	 Structure s_xl_can
		<FieldOffset(0)> Public bitRate As UInt32		 '4
		<FieldOffset(4)> Public sjw As Byte		 '1
		<FieldOffset(5)> Public tseg1 As Byte		 '1
		<FieldOffset(6)> Public tseg2 As Byte		 '1
		<FieldOffset(7)> Public sam As Byte		 '1
		<FieldOffset(8)> Public outputMode As Byte		 '1  sum:9
	End Structure

	'-----------------------------------
	' Function declarations
	'
	' Each driver call returns a status value in the range of 0 to 255 (1 Byte).
	' If 0 is turned back the driver call was successfull, a value >0 describes
	' the reason for failing. See error codes in Constants.vb for details.

	'Bus independent
	Public Declare Function xlOpenDriver Lib "vxlapi.dll" () As Byte
	Public Declare Function xlCloseDriver Lib "vxlapi.dll" () As Byte
	Public Declare Function xlGetApplConfig Lib "vxlapi.dll" (ByVal appName As String, ByVal appChannel As Integer, ByRef hwType As Integer, ByRef hwIndex As Integer, ByRef hwChannel As Integer, ByVal busType As Integer) As Byte
	Public Declare Function xlSetApplConfig Lib "vxlapi.dll" (ByVal appName As String, ByVal appChannel As Integer, ByVal hwType As Integer, ByVal hwIndex As Integer, ByVal hwChannel As Integer, ByVal busType As Integer) As Byte
	Public Declare Function xlPopupHwConfig Lib "vxlapi.dll" (ByRef callSign As String, ByVal waitForFinish As Integer) As Long
	Public Declare Function xlGetChannelIndex Lib "vxlapi.dll" (ByVal hwType As Integer, ByVal hwIndex As Integer, ByVal hwChannel As Integer) As Byte
	Public Declare Function xlGetChannelMask Lib "vxlapi.dll" (ByVal hwType As Integer, ByVal hwIndex As Integer, ByVal hwChannel As Integer) As Int64
	Public Declare Function xlOpenPort Lib "vxlapi.dll" (ByRef PortHandle As UInt32, ByVal appName As String, ByVal accessMask As UInt64, ByRef permissionMask As UInt64, ByVal rxQueueSize As UInt32, ByVal xlInterfaceVersion As UInt32, ByVal busType As UInt32) As Byte
	Public Declare Function xlClosePort Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte
	Public Declare Function xlActivateChannel Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal busType As UInt32, ByVal flags As UInt32) As Byte
	Public Declare Function xlDeactivateChannel Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte
    Public Declare Function xlReceive Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByRef pEventCount As UInt16, ByRef pMessage As s_xlEvent) As Byte
	Public Declare Function xlSetNotification Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByRef handle As UInt64, ByVal queueLevel As Int32) As Byte
	Public Declare Function xlResetClock Lib "vxlapi.dll" (ByVal PortHandle As UInt32) As Byte
	Public Declare Function xlGetErrorString Lib "vxlapi.dll" (ByVal err As Byte) As String
	Public Declare Function xlGetEventString Lib "vxlapi.dll" (ByVal pMessages As s_xlEvent) As String
	Public Declare Function xlFlushReceiveQueue Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessmask As UInt64) As Byte
	Public Declare Function xlGetReceiveQueueLevel Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByRef RxQueueLevel As Long) As Byte
	Public Declare Function xlGetDriverConfig Lib "vxlapi.dll" (ByRef pDriverConfig As s_xl_driver_config) As Byte

	'CAN
	Public Declare Function xlCanSetChannelOutput Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal mode As Byte) As Byte
	Public Declare Function xlCanSetChannelMode Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal tx As UInt32, ByVal txRq As UInt32) As Byte
	Public Declare Function xlCanSetReceiveMode Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal ErrorFrame As Byte, ByVal Chipstate As Byte) As Byte
	Public Declare Function xlCanSetChannelTransceiver Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal Type As Int16, ByVal Mode As Int16, ByVal resNet As Int16) As Byte
	Public Declare Function xlCanSetChannelBitrate Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal Bitrate As UInt32) As Byte
	Public Declare Function xlCanSetChannelAcceptance Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal code As UInt32, ByVal mask As UInt32, ByVal idrange As UInt16) As Byte
	Public Declare Function xlCanAddAcceptanceRange Lib "vxlapi.dll" (ByVal portHandle As UInt32, ByVal accessMask As UInt64, ByVal firstid As UInt32, ByVal lastid As UInt32) As Byte
	Public Declare Function xlCanRemoveAcceptanceRange Lib "vxlapi.dll" (ByVal portHandle As UInt32, ByVal accessMask As UInt64, ByVal firstid As UInt32, ByVal lastid As UInt32) As Byte
	Public Declare Function xlCanResetAcceptance Lib "vxlapi.dll" (ByVal portHandle As UInt32, ByVal accessMask As UInt64, ByVal idRange As UInt16) As Byte
	Public Declare Function xlCanTransmit Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessmask As UInt64, ByRef messageCount As UInt16, <MarshalAs(UnmanagedType.LPArray)> ByVal pMessages As s_xlEvent()) As Byte
	Public Declare Function xlCanFlushTransmitQueue Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessmask As UInt64) As Byte
	Public Declare Function xlCanRequestChipState Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte
	Public Declare Function xlCanSetChannelParams Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByRef pChipParams As s_xl_channelparams) As Byte
	Public Declare Function xlCanSetChannelParamsC200 Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal btr0 As Byte, ByVal btr1 As Byte)

	'SYNC
	Public Declare Function xlGetSyncTime Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByRef time As UInt64) As Byte
	Public Declare Function xlGenerateSyncPulse Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte

	'LIN
	Public Declare Function xlLinSetChannelParams Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal statPar As s_xl_lin_statpar) As Byte
	Public Declare Function xlLinSetSlave Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal LinId As Byte, ByVal data As Byte(), ByVal dlc As Byte, ByVal checksum As UInt16) As Byte
	Public Declare Function xlLinSetDLC Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal LinDlc As Byte()) As Byte
	Public Declare Function xlLinSendRequest Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal LinId As Byte, ByVal flags As UInt32) As Byte
	Public Declare Function xlLinWakeUp Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte
	Public Declare Function xlLinSetSleepMode Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal flags As UInt32, ByVal LinId As Byte) As Byte
	Public Declare Function xlLinSetChecksum Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal Checksum As Byte()) As Byte
    Public Declare Function xlLinSwitchSlave Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal linID As Byte, ByVal mode As Byte)

	'DAIO
	Public Declare Function xlDAIOSetAnalogParameters Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal inputMask As UInt32, ByVal outputMask As UInt32, ByVal highRangeMask As UInt32) As Byte
	Public Declare Function xlDAIOSetAnalogOutput Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal analogLine1 As UInt32, ByVal analogLine2 As UInt32, ByVal analogLine3 As UInt32) As Byte
	Public Declare Function xlDAIOSetAnalogTrigger Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal triggerMask As UInt32, ByVal triggerLevel As UInt32, ByVal triggerEventMode As UInt32) As Byte
	Public Declare Function xlDAIOSetDigitalParameters Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal inputMask As UInt32, ByVal outputMask As UInt32) As Byte
	Public Declare Function xlDAIOSetDigitalOutput Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal outputMask As UInt32, ByVal valuePattern As UInt32) As Byte
    Public Declare Function xlDAIOSetDigitalTrigger Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal triggerMask As UInt32)
    Public Declare Function xlDAIOSetPWMOutput Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal frequency As UInt32, ByVal value As UInt32) As Byte
	Public Declare Function xlDAIOSetMeasurementFrequency Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64, ByVal measurementInterval As UInt32) As Byte
	Public Declare Function xlDAIORequestMeasurement Lib "vxlapi.dll" (ByVal PortHandle As UInt32, ByVal accessMask As UInt64) As Byte




	'Win32 API
    Declare Function WaitForSingleObject Lib "kernel32" (ByVal Win32Handle As UInt64, ByVal dwMilliseconds As Long) As Long
	'Declare Function CreateEvent Lib "kernel32" Alias "CreateEventA" (ByVal lpEventAttributes As String, ByVal bManualReset As Long, ByVal bInitialState As Long, ByVal lpName As String) As Long
    Public Const WAIT_ABANDONED = &H80
    Public Const WAIT_FAILED = &HFFFFFFFF
    Public Const WAIT_OBJECT_0 = &H0
    Public Const WAIT_TIMEOUT = &H102
    Public Const INFINITE = &HFFFF

End Module

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -