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

📄 dbd_write.frm

📁 可以读些S7-300PLC中的变量数据
💻 FRM
📖 第 1 页 / 共 4 页
字号:
   Begin VB.Label Label13 
      Caption         =   "入口扫描原点到钢板末端距离"
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   13080
      TabIndex        =   24
      Top             =   8640
      Width           =   1455
   End
   Begin VB.Label Label12 
      Caption         =   "入口扫描原点到钢板边缘距离"
      ForeColor       =   &H00C00000&
      Height          =   375
      Left            =   11280
      TabIndex        =   23
      Top             =   8760
      Width           =   1455
   End
   Begin VB.Label Label11 
      Caption         =   "入口扫描钢板宽度"
      Height          =   375
      Left            =   11040
      TabIndex        =   22
      Top             =   7080
      Width           =   1095
   End
   Begin VB.Line Line6 
      BorderStyle     =   2  'Dash
      X1              =   12360
      X2              =   12360
      Y1              =   6720
      Y2              =   8400
   End
   Begin VB.Line Line5 
      BorderStyle     =   2  'Dash
      X1              =   12600
      X2              =   12120
      Y1              =   6720
      Y2              =   6720
   End
   Begin VB.Line Line4 
      BorderStyle     =   2  'Dash
      X1              =   12600
      X2              =   12120
      Y1              =   8400
      Y2              =   8400
   End
   Begin VB.Line Line3 
      BorderColor     =   &H000000FF&
      BorderStyle     =   2  'Dash
      X1              =   12960
      X2              =   12960
      Y1              =   6720
      Y2              =   10080
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00C00000&
      BorderStyle     =   2  'Dash
      X1              =   12840
      X2              =   12840
      Y1              =   8400
      Y2              =   10080
   End
   Begin VB.Shape Shape2 
      BackColor       =   &H000000FF&
      FillColor       =   &H00FFFFFF&
      FillStyle       =   0  'Solid
      Height          =   255
      Left            =   12720
      Shape           =   3  'Circle
      Top             =   10080
      Width           =   375
   End
   Begin VB.Shape Shape1 
      Height          =   1695
      Left            =   12600
      Top             =   6720
      Width           =   2415
   End
   Begin VB.Label Label10 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "出口扫描起点到钢板末端距离mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6720
      TabIndex        =   16
      Top             =   2280
      Width           =   3975
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "出口扫描起点到钢板边缘距离mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6720
      TabIndex        =   15
      Top             =   1680
      Width           =   3975
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "出口扫描完成后计算入口钢板宽度mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6720
      TabIndex        =   14
      Top             =   1080
      Width           =   3975
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "出口扫描电机返回编码器显示值"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6720
      TabIndex        =   13
      Top             =   3000
      Width           =   3975
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "出口扫描编码器值显示"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6720
      TabIndex        =   12
      Top             =   480
      Width           =   3975
   End
   Begin VB.Label Label8 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "入口扫描电机返回编码器显示值"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   6
      Top             =   3000
      Width           =   3975
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "入口扫描起点到钢板末端距离mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   5
      Top             =   2280
      Width           =   3975
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "入口扫描起点到钢板边缘距离mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   4
      Top             =   1680
      Width           =   3975
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "入口扫描完成后计算入口钢板宽度mm"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   3
      Top             =   1080
      Width           =   3975
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "入口扫描编码器值显示"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   0
      Top             =   480
      Width           =   3975
   End
   Begin VB.Line Line13 
      BorderColor     =   &H00FFFFFF&
      BorderWidth     =   5
      X1              =   3960
      X2              =   3960
      Y1              =   8400
      Y2              =   6720
   End
   Begin VB.Line Line14 
      BorderColor     =   &H00FFFFFF&
      BorderWidth     =   5
      X1              =   14520
      X2              =   14520
      Y1              =   8400
      Y2              =   6720
   End
End
Attribute VB_Name = "DBD_WRITE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub write_program()
Dim write_byte() As Byte
Dim float_byte() As Byte
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Single

BLOCKNO = 2
no = 0
AMOUNT = 4
a = Text1.Text
write_byte = Write_s7_300_DINT(a)

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

res = d_field_write(BLOCKNO, no, AMOUNT, write_byte(0))
'-------------------------------------------------------------
BLOCKNO = 2
no = 4
AMOUNT = 4
b = Text2.Text
write_byte = Write_s7_300_DINT(b)

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

res = d_field_write(BLOCKNO, no, AMOUNT, write_byte(0))
'---------------------------------------------------------------
BLOCKNO = 2
no = 8
AMOUNT = 4
c = Text3.Text
write_byte = Write_s7_300_DINT(c)

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

res = d_field_write(BLOCKNO, no, AMOUNT, write_byte(0))
'-------------------------------------------------------------
BLOCKNO = 2
no = 12
AMOUNT = 4
d = Text4.Text
float_byte = Write_S7_300_Real(d)

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

res = d_field_write(BLOCKNO, no, AMOUNT, float_byte(0))




End Sub


Private Sub ENTRY_SCAN_DBD_READ()
Dim READ_BYTE(1024) As Byte
Dim Byte1 As Long
Dim Byte2 As Long
Dim Byte3 As Long
Dim Byte4 As Long
Dim combination As Long


'----入口编码器值显示DB2.DBD54数据类型DINT--------------------------
BLOCKNO = 2
no = 54
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

EntryEncodeShow = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4

LED1.LEDSTRING = EntryEncodeShow
'-----入口扫描电机返回原点编码器值显示DB2.DBD102 DINT-----------------

BLOCKNO = 2
no = 102
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

EntryScanReturnHomeEncodeShow = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4

LED2.LEDSTRING = EntryScanReturnHomeEncodeShow
Text4.Text = EntryScanReturnHomeEncodeShow
'-------入口扫描钢板宽度DB2.DBD98 REAL---------------------------------------------
BLOCKNO = 2
no = 98
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

combination = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4
EntryScanSteelWidth = Read_S7_300_Real(combination)
LED3.LEDSTRING = EntryScanSteelWidth
Text1.Text = EntryScanSteelWidth
'------入口扫描原点到钢板边缘的距离DB2.DBD94 REAL-----------------------------------------------------------------
BLOCKNO = 2
no = 94
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

combination = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4
EntryScanHomeToSteelEdgeDistance = Read_S7_300_Real(combination)
LED4.LEDSTRING = EntryScanHomeToSteelEdgeDistance
Text2.Text = EntryScanHomeToSteelEdgeDistance
'-------入口扫描原点到钢板末端的距离DB25.DBD16 REAL--------------------------------------------------------
BLOCKNO = 25
no = 16
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

combination = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4
EntryScanHomeToSteelEndDistance = Read_S7_300_Real(combination)
LED5.LEDSTRING = EntryScanHomeToSteelEndDistance
Text3.Text = EntryScanHomeToSteelEndDistance
'----------------------------------------------------------------------

End Sub

Private Sub EXIT_SCAN_DBD_READ()
Dim READ_BYTE(1024) As Byte
Dim Byte1 As Long
Dim Byte2 As Long
Dim Byte3 As Long
Dim Byte4 As Long
Dim combination As Long


'----出口编码器值显示DB2.DBD58数据类型DINT--------------------------
BLOCKNO = 2
no = 58
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

ExitEncodeShow = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4

LED6.LEDSTRING = ExitEncodeShow
'-----出口扫描电机返回原点编码器值显示DB2.DBD142 DINT-----------------

BLOCKNO = 2
no = 142
AMOUNT = 4

res = new_ss(VerbIdx + 1)

res = d_field_read(BLOCKNO, no, AMOUNT, READ_BYTE(0))

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

ExitScanReturnHomeEncodeShow = Byte1 * 16777216 + Byte2 * 65536 + Byte3 * 256 + Byte4

LED7.LEDSTRING = ExitScanReturnHomeEncodeShow

⌨️ 快捷键说明

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