PLZ-5W Series Electronic Load

Commnunication Interface Mannual


 

Appendix

Sample of ARB:DATA

This is a sample program that sets ARB:DATA on Visual Basic 2013.

A programming example in which the voltage-current pairs are (0 V, 0 A), (1 V, 0.1 A), (157.5 V, 0.1 A) are provided below. The first voltage and current are fixed to “0V, 0A,” and the last voltage is fixed to “157.5V.” If you specify any other values, an error is returned.

Setting ARB:DATA


Private Sub CommandArbSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CommandArbSet.Click
  ' Data to set in the ARB table
  Dim Dbl_Volt() As Double = {0, 1, 157.5}
  Dim Dbl_Curr() As Double = {0, 0.1, 0.1}

  ' Convert the unit to the μ order
  Dim Int_Data(5) As Integer
  Dim Int_a As Integer = 0
  For Int_b As Integer = 0 To 2
    Int_Data(Int_a) = CInt(Dbl_Volt(Int_b) * 1000000)
    Int_a = Int_a + 1
    Int_Data(Int_a) = CInt(Dbl_Curr(Int_b) * 1000000)
    Int_a = Int_a + 1
  Next

  Dim Byte_Data(41) As Byte
  Dim Byte_Comm() As Byte = System.Text.Encoding.ASCII.GetBytes("ARB:DATA #40024") ‘ Convert the command and LENGTH parts to byte type
  Dim Int_Count As Integer = 0

  For Int_Count = 0 To 14
    Byte_Data(Int_Count) = Byte_Comm(Int_Count) ' Insert at the head of the byte array to be sent
  Next

  Dim Byte_VoltCurr(4) As Byte
  For Int_m As Integer = 0 To 5
    Byte_VoltCurr = BitConverter.GetBytes(Int_Data(Int_m)) ' Convert the data that you want to set in the ARB table into byte type one at a time
    For Int_n As Integer = 0 To 3
      Byte_Data(Int_Count) = Byte_VoltCurr(Int_n) ' Fill the converted data in order into the byte array to be sent
      Int_Count = Int_Count + 1
    Next
  Next

  Byte_Data(Int_Count + 1) = CByte(&HA) ' Insert a line feed at the end of the byte array

  msg.Write(Byte_Data, 41) 'Write in the PLZ-5W
  msg.WriteString("ARB:APPL" & vbLf) ' Apply the ARB data
End Sub
	

Querying ARB:DATA


  Dim rm As IResourceManager3 = New ResourceManager()
  Dim msg As IMessage
  Dim seri As ISerial
Private Sub ARB_DATA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  RichText.Clear()                                      ' Initialize the RichTextBox that is to display the ARB table values
  msg.WriteString("ARB:COUN?" & vbLf)                   ' Determine the number data pairs in the ARB table
  Dim Int_ArbCoun As Integer = CInt(msg.ReadString(32))
  Dim Int_ByteLength As Integer = Int_ArbCoun * 8 + 7   ' Calculate the total number of bytes to receive

  msg.TerminationCharacterEnabled = False               ' Disable the terminator
  seri.EndIn = SerialEndConst.ASRL_END_NONE             ' Set this also to use 232C
  msg.WriteString("ARB:DATA?" & vbLf)                   ' Write a query command in the PLZ-5W
  Dim Byte_ArbRead() As Byte = msg.Read(Int_ByteLength) ' Read the response from the PLZ-5W

  Dim Int_Volt(Int_ArbCoun) As Integer ' Calculate the number of data values from  and prepare a box
  Dim Int_Curr(Int_ArbCoun) As Integer
  Dim Dbl_Volt(Int_ArbCoun) As Double
  Dim Dbl_Curr(Int_ArbCoun) As Double
  Dim Int_Count As Integer = 6
  For Int_a = 0 To Int_ArbCoun - 1
    Int_Volt(Int_a) = BitConverter.ToInt32(Byte_ArbRead, Int_Count) ' Convert in order from the top the byte type data into integers
    Dbl_Volt(Int_a) = Int_Volt(Int_a) / 1000000 ' Convert the unit from μV order to V order
    Int_Count = Int_Count + 4
    Int_Curr(Int_a) = BitConverter.ToInt32(Byte_ArbRead, Int_Count) ' Convert from the top the byte type data into integers
    Dbl_Curr(Int_a) = Int_Curr(Int_a) / 1000000 ' Convert the unit from μV order to V order
    Int_Count = Int_Count + 4
    RichText.Text = RichText.Text & CStr(Dbl_Volt(Int_a)) & " , " & CStr(Dbl_Curr(Int_a)) & vbCrLf ' Write the ARB data as voltage-current pairs
  Next

  msg.TerminationCharacterEnabled = True        ' Enable the terminator
  seri.EndIn = SerialEndConst.ASRL_END_TERMCHAR ' Reset to default
End Sub
	

The program execution result is as follows.

  

Related information

Using Visual Basic 2013

ARB:DATA

>top

Setup

Overview of Command

Command (function search)

Command (ABC search)

Command (Sub-system search)

Register

Appendix

Tutorial

Electronic Load  PLZ-5W seriesElectronic Load PLZ-5W series
Communication Interface Manual