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

📄 dcon_pc.bas

📁 通过vb与鸿格7000系列模块进行通讯
💻 BAS
📖 第 1 页 / 共 2 页
字号:
'          but user must declare both the variable in function
'    for example:
'    float fVal;
'    int iVal,format;
'    short ret;
'    ....
'    format=0;
'    fVal=5.0;
'    iVal=0;
'    ret= DCON_Read_AO(1,1,-1,0,4,0,300,format,&fVal,&iVal)as integer
'
'    //then the current AO value will be fVal, the iVal will get the default 0
'**********************************************************************************/

Declare Function DCON_Read_AI Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iChannel As Integer, ByVal iAI_TotalCh As Integer, _
        ByVal iCheckSum As Integer, ByVal iTimeOut As Integer, ByVal iDataFormat As Integer, _
        ByRef fValue As Single, ByRef iValue As Integer) As Integer
'/*****************************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: for 7K and 87K (on 87K IO Expansion bus)
'    iChannel: 0~7
'    iAI_TotalCh: 1~ N, total AI channels
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'
'    *fValue:the AI value (engineering , % or ohmn data type).
'
'    return: 0 = No Error
'            other = error code.
'******************************************************************************/

Declare Function DCON_Read_Counter Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iChannel As Integer, ByVal iCheckSum As Integer, _
        ByVal iTimeOut As Integer, ByRef lCounter_Value As Long) As Integer
'/**********************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: 7K and 87K (on 87K IO Expansion bus)
'    iChannel: 0~15
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'    *lCounter_Value: counter value.
'
'    return: 0 = No Error
'            other = error code.
'***********************************************************************/

Declare Function DCON_Clear_Counter Lib "DCON_PC.dll" (ByVal iComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iChannel As Integer, ByVal iCheckSum As Integer, _
        ByVal iTimeOut As Integer) As Integer
'/*********************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: 7K and 87K (on 87K IO Expansion bus)
'    iChannel: 0~15
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'
'    return: 0 = No Error
'            other = error code.
'***********************************************************************/

Declare Function DCON_Read_DIO Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iDI_TotalCh As Integer, ByVal iDO_TotalCh As Integer, _
        ByVal iCheckSum As Integer, ByVal iTimeOut As Integer, ByRef lDI_Value As Long, _
        ByRef lDO_Value As Long, ByRef cDI_BitValue As Byte, ByRef cDO_BitValue As Byte) As Integer
'/*********************************************************************************
'   iComPort: 1 ~ 255
'   iAddress: 0 ~ 255: the RS-485 Address of module
'   iSlot: 0~7: for 8K and 87K series on i-8000 system
'           -1: 7K and 87K (on 87K IO Expansion bus)
'   iDI_TotalCh: 0~32. total DI channels,used to define the input bytes
'   iDO_TotalCh: 0~32. total DO channels,used to define the output bytes
'   iCheckSum: 0: disabled
'1:               Enabled
'   iTimeOut: timeout value to wait response. unit= ms.
'   *lDI_Value: DI value.
'               for example: 0x32==> ch5=1, ch4=1, ch1=1,
'                                    others are 0.
'   *lDO_Value: DO read back value.
'               for example: 0x32==> ch5=on, ch4=on, ch1=on,
'                                    others are off.
'   *cDI_BitValue: DI value.
'                  for example: {0,1,0,0,1,1}
'                  ==> bit0=0,bit1=1,bit2=0,bit3=0,bit4=1,bit5=1.
'   *cDO_BitValue: DO read back value.
'                  for example: {0,1,0,0,1,1}
'                  ==> bit0=0,bit1=1,bit2=0,bit3=0,bit4=1,bit5=1.
'
'    return: 0 = No Error
'            15= timeout (No response)
'**********************************************************************************/

Declare Function DCON_READ_DIO_Latch Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iDI_TotalCh As Integer, ByVal iDO_TotalCh As Integer, _
        ByVal iLatchType As Integer, ByVal iCheckSum As Integer, ByVal iTimeOut As Integer, _
        ByRef lDI_Latch_Value As Long, ByRef lDO_Latch_Value As Long, _
        ByRef cDI_Latch_BitValue As Byte, ByRef cDO_Latch_BitValue As Byte) As Integer
'/***************************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: 7K and 87K (on 87K IO Expansion bus)
'    iDI_TotalCh: 0~32. total DI channels,used to define input bytes
'    iDO_TotalCh: 0~32. total DO channels,used to define the output bytes
'    iLatchType: 0 = Logic Low Latched
'                1 = Logic High Latched
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'    *lDI_Latch_Value: DI latch value.
'                for example: 0x32==> ch5=1, ch4=1, ch1=1,
'                                     others are 0.
'    *lDO_Latch_Value: DO read back latch value.
'                for example: 0x32==> ch5=on, ch4=on, ch1=on,
'                                     others are off.
'    *cDI_Latch_BitValue: DI latch value.
'                   for example: {0,1,0,0,1,1}
'                   ==> bit0=0,bit1=1,bit2=0,bit3=0,bit4=1,bit5=1.
'    *cDO_Latch_BitValue: DO read back latch value.
'                   for example: {0,1,0,0,1,1}
'                   ==> bit0=0,bit1=1,bit2=0,bit3=0,bit4=1,bit5=1.
'
'    return: 0 = No Error
'            15= timeout (No response)
'****************************************************************************/

Declare Function DCON_Clear_DIO_Latch Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iCheckSum As Integer, ByVal iTimeOut As Integer) As Integer
'/*******************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: 7K and 87K (on 87K IO Expansion bus)
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'
'
'    return: 0 = No Error
'            15= timeout (No response)
'
'
'**********************************************************************/

Declare Function DCON_Read_Overflow Lib "DCON_PC.dll" (ByVal cComPort As Byte, ByVal iAddress As Integer, _
        ByVal iSlot As Integer, ByVal iChannel As Integer, ByVal iCheckSum As Integer, _
        ByVal iTimeOut As Integer, ByRef iOverflow As Long) As Integer
'/*******************************************************************
'    iComPort: 1 ~ 255
'    iAddress: 0 ~ 255: the RS-485 Address of module
'    iSlot: 0~7: for 8K and 87K series on i-8000 system
'            -1: 7K and 87K (on 87K IO Expansion bus)
'    iCheckSum: 0: disabled
'1:                Enabled
'    iTimeOut: timeout value to wait response. unit= ms.
'
'
'    return: 0 = No Error
'            15= timeout (No response)
'
'
'**********************************************************************/

⌨️ 快捷键说明

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