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

📄 dbd_read.frm

📁 可以读些S7-300PLC中的变量数据
💻 FRM
字号:
VERSION 5.00
Object = "{F7E6FD03-521A-11D2-BEA3-000021DAEE5C}#2.0#0"; "Led.ocx"
Begin VB.Form DBD_READ_Frame 
   Caption         =   "Form1"
   ClientHeight    =   7170
   ClientLeft      =   3300
   ClientTop       =   2340
   ClientWidth     =   9825
   LinkTopic       =   "Form1"
   ScaleHeight     =   7170
   ScaleWidth      =   9825
   Begin LedOCX.LED LED1 
      Height          =   615
      Left            =   6600
      TabIndex        =   7
      Top             =   2760
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   1085
      ForeColor       =   49152
      BackColor       =   0
      BorderStyle     =   1
      LEDSIZE         =   120
      LEDWIDTH        =   1
      LEDSTRING       =   "123"
      LEDLEFT         =   60
      LEDTOP          =   60
      LEDXYRATE       =   1
   End
   Begin VB.TextBox Text5 
      Height          =   495
      Left            =   1680
      TabIndex        =   6
      Text            =   "Text5"
      Top             =   5160
      Width           =   1455
   End
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   1680
      TabIndex        =   5
      Text            =   "Text4"
      Top             =   4320
      Width           =   1455
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   1680
      TabIndex        =   4
      Text            =   "Text3"
      Top             =   3600
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1680
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   2760
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   42
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1230
      Left            =   360
      MultiLine       =   -1  'True
      TabIndex        =   2
      Text            =   "DBD_READ.frx":0000
      Top             =   720
      Width           =   9015
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Stop Read"
      Height          =   615
      Left            =   5760
      TabIndex        =   1
      Top             =   6000
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Start_cycle_Read"
      Height          =   615
      Left            =   1320
      TabIndex        =   0
      Top             =   6000
      Width           =   1935
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   10
      Left            =   480
      Top             =   3000
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "焊接速度显示"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   600
      Left            =   4080
      TabIndex        =   8
      Top             =   2760
      Width           =   2355
   End
End
Attribute VB_Name = "DBD_READ_Frame"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DBD_DINT
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub DBW_READ()
Dim Byte1 As Long
Dim Byte2 As Long
Dim Byte3 As Long
Dim Byte4 As Long
Dim combination As Long
Dim s7_real


BLOCKNO = 2
no = 0
AMOUNT = 4

res = new_ss(VerbIdx + 1)
If (res = 0) Then

res = d_field_read(BLOCKNO, no, AMOUNT, value_byte(0))
'res = d_field_read(BLOCKNO, no, AMOUNT, DBW(0))
'res = DB_READ(BLOCKNO, no, AMOUNT, dbww(0))

Byte1 = value_byte(0)
Byte2 = value_byte(1)
Byte3 = value_byte(2)
Byte4 = value_byte(3)

combination = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4
s7_real = Read_S7_300_Real(combination)
Text1.Text = s7_real
'--------------------------------------------------------------

LED1.LEDSTRING = s7_real
'--------------------------------------------------------------

Text2.Text = value_byte(0)
Text3.Text = value_byte(1)
Text4.Text = value_byte(2)
Text5.Text = value_byte(3)
End If

If (res <> 0) Then
   ERROR_FRM.Show 1, Me
   Timer1.Enabled = False
End If

End Sub



Private Sub Command2_Click()
Timer1.Enabled = False
End Sub



Private Sub Form_Load()
LED1.LEDSTRING = ""
End Sub

Private Sub Timer1_Timer()
Call DBW_READ

End Sub

⌨️ 快捷键说明

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