Author Topic: EXCEL WITH MACRO TO RUN SDM3055, SDG1032X AND RD6006P  (Read 553 times)

0 Members and 1 Guest are viewing this topic.

Offline uargoTopic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
EXCEL WITH MACRO TO RUN SDM3055, SDG1032X AND RD6006P
« on: November 26, 2023, 01:15:48 am »
Hello, I have been testing an Excel with a macro inside that is capable of managing a Siglent multimeter from the SDM3000 series, a Siglent signal generator from the SDG1000 series (other series may also work) and a Riden RD6006P source.
Manage Siglent devices via LAN and the Riden source via USB.
It is still in the Alpha phase and whoever uses it should understand that it may still not work completely well.

Functions it has:

1) It is capable of taking AC and DC measurements indefinitely from the SDM3000 and storing them in Excel itself.
2) Choose a maximum intensity and vary the voltage from the source and measure DC voltage and current and store the values in Excel and it will automatically generate a graph. graph (V vs Intensity)
2) Choose an rms AC voltage and vary the frequency from the SDG1000 and measure AC voltage and store the values in Excel and it generates a graph automatically. graph (V vs Frequency)

allows you to make a basic bode plot

https://drive.google.com/file/d/1QwC-W-pvLDK3XJuieplhsSMR9Ag6pSxP/view?usp=sharing


Once the file is downloaded, go to where the file was downloaded, right click on it, and unlock
« Last Edit: November 26, 2023, 01:29:29 am by uargo »
 
The following users thanked this post: coromonadalix, KungFuJosh

Offline uargoTopic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: EXCEL WITH MACRO TO RUN SDM3055, SDG1032X AND RD6006P
« Reply #1 on: November 27, 2023, 08:54:28 am »
I suppose you all know how to manage the Siglent via SCPI, but for those interested in managing the Riden power supplies, I will tell you that it is done via USB in the RTU MODBUS protocol, that is, (serial MODBUS), and I will add some links to the tables of the addresses etc

https://github.com/Baldanos/rd6006/blob/master/registers.md

example;
Code: [Select]

 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Dim MSComm As Object
    Dim Buffer() As Byte
    Dim a As Long
    Dim tt As Long
    Dim dd As Double
       
    Dim volt As Double
    Dim amp As Double


    ' Build Modbus RTU request (write to register 9 set amp)
    ReDim Buffer(5)
    Buffer(0) = &H1
    Buffer(1) = &H6
    Buffer(2) = &H0
    Buffer(3) = &H9  'amperage set
    dd = CDbl(amp) * 10000 'convert the variable amp to double and multiply by 10000, to convert it to Amperes
    tt = dd
    Buffer(4) = tt \ 256
    Buffer(5) = tt Mod 256
    a = enviamodbus(Buffer)
   
    'Build the Modbus RTU request (write to register 8 set volt)
    ReDim Buffer(5)
    Buffer(0) = &H1
    Buffer(1) = &H6
    Buffer(2) = &H0
    Buffer(3) = &H8  'set voltage
    dd = CDbl(volt) * 1000 'convert the variable volt to double and multiply by 1000, to convert it to volts
    tt = dd
    Buffer(4) = tt \ 256
    Buffer(5) = tt Mod 256
    a = enviamodbus(Buffer)
   
    'Build Modbus RTU request (write to register 18-12Hex set on/off)
    ReDim Buffer(5)
    Buffer(0) = &H1
    Buffer(1) = &H6
    Buffer(2) = &H0
    Buffer(3) = &H12  'set on/off
    Buffer(4) = &H0
    Buffer(5) = &H1  '&H1 = on   /  &H0 = off
    a = enviamodbus(Buffer)
 

Public Function enviamodbus(data() As Byte) As Boolean
    Dim MSComm As Object
    'Dim Buffer() As Byte
    Dim i As Integer
    Dim a As Long
    Dim b, c As Byte
    Dim bufferr As String
   
    'Instantiate serial port control
    Set MSComm = CreateObject("MSCOMMLib.MSComm.1")
    ' Open the serial port on textbox3 (adjust settings as necessary)
    MSComm.CommPort = Int(TextBox3.Text)   
    MSComm.Settings = "115200,N,8,1"  ' Communication settings
    MSComm.InputLen = 0  ' Input length (0 to receive all)
    ' Abrir el puerto serie
    MSComm.PortOpen = True
   
    'Calculate CRC16 (CRC16 checksum)
    a = CRC16(data)
    b = a \ 256
    c = a Mod 256
    ' Add the CRC16 bytes to the buffer
    ReDim Preserve data(UBound(data) + 2)
    data(UBound(data) - 1) = c  ' Byte
    data(UBound(data)) = b      ' Byte
   
    MSComm.Output = data
    bufferr = ""
    hh = 0
    Do
        'Bufferr = Bufferr & MSComm.Input
        bufferr = MSComm.Input
        hh = hh + 1
        Sleep (5)
        DoEvents
    Loop Until Len(bufferr) > 6 Or hh > 40 '6
   
    MSComm.PortOpen = False
    enviamodbus = True

End Function


« Last Edit: November 27, 2023, 08:56:57 am by uargo »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf