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

📄 example.frm

📁 16 relay output channels and 16 isolated digital input channels LED indicators to show activated
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "PCL-752 Example"
   ClientHeight    =   3090
   ClientLeft      =   2610
   ClientTop       =   1755
   ClientWidth     =   5085
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   5085
   Begin VB.TextBox txtclose 
      Height          =   375
      Left            =   1440
      TabIndex        =   5
      Text            =   "Text3"
      Top             =   2280
      Width           =   1095
   End
   Begin VB.TextBox txtopen 
      Height          =   375
      Left            =   1440
      TabIndex        =   4
      Text            =   "Text2"
      Top             =   360
      Width           =   1095
   End
   Begin VB.TextBox txtread 
      Height          =   375
      Left            =   1440
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   1320
      Width           =   1095
   End
   Begin VB.CommandButton cmdclose 
      Caption         =   "CloseComm"
      Height          =   615
      Left            =   3000
      TabIndex        =   2
      Top             =   2160
      Width           =   1695
   End
   Begin VB.CommandButton cmdRead 
      Caption         =   "Read ISA +5V value"
      Height          =   615
      Left            =   3000
      TabIndex        =   1
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CommandButton cmdopen 
      Caption         =   "OpenComm"
      Height          =   615
      Left            =   3000
      TabIndex        =   0
      Top             =   240
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "Return value"
      Height          =   252
      Left            =   240
      TabIndex        =   8
      Top             =   2280
      Width           =   1092
   End
   Begin VB.Label Label1 
      Caption         =   "Return value"
      Height          =   252
      Left            =   240
      TabIndex        =   7
      Top             =   1320
      Width           =   1092
   End
   Begin VB.Label Label3 
      Caption         =   "Return value"
      Height          =   252
      Left            =   240
      TabIndex        =   6
      Top             =   360
      Width           =   972
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'The Program is PCL-752 call DLL driver Example
'The call DLL driver procedure
'   First set OpenComm parameter
'   Call OpenComm API
'   Then Call other function API
'   Final must be CloseComm

Option Explicit

Dim RaConfig As RASCONFIG
Dim ReturnValue As Long
Dim LPuData As Integer
Dim LPuData1 As Long
Dim LPfData As Single
   
Dim BoardID As Long
Dim LPuBaud As Long
Dim LPuBoardConfig As Long
Dim Time As String * 32
Dim Time1 As String
Dim TELnum As String * 16
Dim TELnum1 As String
Dim SYSID As String * 32
Dim SYSID1 As String
Dim HardwareVer As String * 32
Dim FirmwareVer As String * 32
Dim Response As Integer

Dim Open_success As Boolean

Private Sub cmdclose_Click()    'CloseComm
ReturnValue = CloseComm(BoardID)
If ReturnValue = 0 Then
    Open_success = False
    txtclose.Text = "Close success"
 Else
    txtclose.Text = "Close failed"
End If
  txtread.Text = ""
  txtopen.Text = ""
End Sub

Private Sub cmdopen_Click()     'OpenComm
txtclose.Text = ""
txtread.Text = ""
RaConfig.uLinkWay = 0           'set Linkway (0 for I/O link)
RaConfig.uPortNum = 0           'set PortNum or device number
RaConfig.uBoardID = BoardID     'set BoardID number
RaConfig.uBaud = 4              'set COM port Baudrate
RaConfig.cTEL = 275             'set telphone number for modem
RaConfig.bRS485 = 0             'set RS-232/RS-485 connecting mode (0 for RS-232)

If Open_success = False Then
    ReturnValue = OpenComm(RaConfig)    'Call OpenComm API
  If ReturnValue = 0 Then               'Sense OpenComm success or failure
     Open_success = True                'ReturnValue -> 0 Open success
     txtopen.Text = "Open success"
   Else
     Open_success = False               'ReturnValue -> 1 Open fail
     txtopen.Text = "Open failed"
  End If
 Else
  Response = MsgBox("PCL-752 is opened", vbOKOnly, "PCL-752 Message", "", 0)
End If

End Sub

Private Sub cmdRead_Click()
ReturnValue = RASAnalogIn(BoardID, 3, LPfData)
If ReturnValue = 0 Then
    txtread.Text = CStr(LPfData)
 Else
    txtread.Text = "Read Error"
End If
txtopen.Text = ""
txtclose.Text = ""
End Sub

Private Sub Form_Load()

    Open_success = False
    BoardID = 1
    txtopen.Text = ""
    txtread.Text = ""
    txtclose.Text = ""

End Sub

Private Sub Form_Unload(Cancel As Integer)

    If Open_success = True Then
      Response = MsgBox("Close PCL-752 Link", vbOKOnly, "PCL-752 Message", "", 0)
      ReturnValue = CloseComm(BoardID)
    End If
    
End Sub

⌨️ 快捷键说明

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