www.pudn.com > Vb6.0.rar > mainframe.frm, change:2004-03-17,size:3957b


VERSION 5.00 
Begin VB.Form Main_Frame  
   Caption         =   "DMC1000编程示例之五" 
   ClientHeight    =   1680 
   ClientLeft      =   3630 
   ClientTop       =   3885 
   ClientWidth     =   4230 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   1680 
   ScaleWidth      =   4230 
   Begin VB.Timer Timer1  
      Interval        =   100 
      Left            =   3960 
      Top             =   120 
   End 
   Begin VB.CheckBox Check4  
      Caption         =   "输出4:低电平" 
      Height          =   255 
      Left            =   2280 
      TabIndex        =   3 
      Top             =   720 
      Width           =   1695 
   End 
   Begin VB.CheckBox Check3  
      Caption         =   "输出3:低电平" 
      Height          =   300 
      Left            =   2280 
      TabIndex        =   2 
      Top             =   240 
      Width           =   1575 
   End 
   Begin VB.CheckBox Check2  
      Caption         =   "输出2:低电平" 
      Height          =   300 
      Left            =   360 
      TabIndex        =   1 
      Top             =   720 
      Width           =   1575 
   End 
   Begin VB.CheckBox Check1  
      Caption         =   "输出1:低电平" 
      Height          =   375 
      Left            =   360 
      TabIndex        =   0 
      Top             =   240 
      Width           =   1695 
   End 
   Begin VB.Label Label_INPUT  
      Alignment       =   2  'Center 
      BorderStyle     =   1  'Fixed Single 
      Caption         =   "Label1" 
      Height          =   375 
      Left            =   120 
      TabIndex        =   4 
      Top             =   1200 
      Width           =   3975 
   End 
End 
Attribute VB_Name = "Main_Frame" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'******************************************** 
'    雷赛DMC1000控制卡编程示例之五 
' 
'? -主要演示功能: 
'    1. 数字端口的输出 
'    2. 数字端口输入信号的查询 
' 
'!-关键函数: 
'    数字输出 
'        d1000_out_bit 
' 
'    输入信号查询 
'        d1000_get_in_bit 
' 
' 
'#-注意事项: 
'        本控制卡共有12路数字输出,16路数字输入,在本例只作 
'    4路输出输入用以演示,所有其它I/O操作皆相似。 
' 
'    Writen by LEISAI-SUPPORT 
'    FAX: 0755 - 26402718 
'    TEL: 0755 - 26434329 
'EMAIL:     support@ leisai.com 
'HTTP:     www.leisai.com 
'******************************************** 
 
Private Sub Check1_Click() 
    UpdateControl 
End Sub 
 
Private Sub Check2_Click() 
    UpdateControl 
End Sub 
 
Private Sub Check3_Click() 
    UpdateControl 
End Sub 
 
Private Sub Check4_Click() 
    UpdateControl 
End Sub 
 
Private Sub Form_Load() 
    If d1000_board_init() <= 0 Then '控制卡初始化 
        MsgBox "未找到控制卡!", vbOKOnly, "警告" 
    End If 
 
    UpdateControl 
 
End Sub 
 
Public Sub UpdateControl() 
 
    If Check1 = 1 Then 
        Check1.Caption = "输出1:高电平" 
        d1000_out_bit 1, 1 
    Else 
        Check1.Caption = "输出1:低电平" 
        d1000_out_bit 1, 0 
    End If 
     
    If Check2 = 1 Then 
        Check2.Caption = "输出2:高电平" 
        d1000_out_bit 2, 1 
    Else 
        Check2.Caption = "输出2:低电平" 
        d1000_out_bit 2, 0 
    End If 
     
    If Check3 = 1 Then 
        Check3.Caption = "输出3:高电平" 
        d1000_out_bit 3, 1 
    Else 
        Check3.Caption = "输出3:低电平" 
        d1000_out_bit 3, 0 
    End If 
     
    If Check4 = 1 Then 
        Check4.Caption = "输出4:高电平" 
        d1000_out_bit 4, 1 
    Else 
        Check4.Caption = "输出4:低电平" 
        d1000_out_bit 4, 0 
    End If 
     
End Sub 
 
 
Private Sub Form_Unload(Cancel As Integer) 
    d1000_board_close 
 
End Sub 
 
Private Sub Timer1_Timer() 
    Label_INPUT.Caption = "输入1(" + Str(d1000_in_bit(1)) + "),输入2(" + Str(d1000_in_bit(2)) + "),输入3(" + Str(d1000_in_bit(3)) + "),输入4(" + Str(d1000_in_bit(4)) + ")" 
     
End Sub