14 retrieval of setup data and configuration – Yokogawa PC-Based MX100 User Manual
Page 701
14-15
IM MX190-01E
MX100 for Extended API - Visual Basic -
14
Retrieval of Setup Data and Configuration
Program Example
Attribute VB_Name = "Module1"
Public Sub Main()
Dim comm As Long '/descriptor
Dim rc As Long '/return (error) code
Dim i As Long '/counter
Dim strItem As String * 512 '/string buffer
Dim lenItem As Long '/size of buffer
Dim realLen As Long '/real size of string by
function returned
'/set size
lenItem = 512
'/open
comm = openMX100("192.168.1.12", rc)
'/get
rc = getItemAllMX100(comm)
'/loop by items
For i = DAQMX_ITEM_ALL_START To DAQMX_ITEM_ALL_END
'/read
rc = readItemMX100(comm, i, strItem, lenItem, realLen)
'/write
rc = writeItemMX100(comm, i, strItem)
Next i
'/set
rc = setItemAllMX100(comm)
'/close
rc = closeMX100(comm)
End Sub
Description
Overview
The program is an example of reading and writing all setup items. The following four
actions are executed.
• Gets the setup data from the MX100 collectively.
• Retrieves the setup data of the setup data field by item.
• Writes the setup data in the setup data field by item.
• Sends the setup data to the MX100 collectively.
Each item is retrieved and written from the first number to the end number.
Be sure to prepare string fields of sufficient size.
By saving and loading groups of item numbers and item strings, you can backup the
setup data.
For setup item numbers, see section 6.3.
14.2 Programming - MX100/Visual Basic -