top of page

Instrument Control module

This post demonstrates how to get data from a measuring instrument in Scilab and display it using Equalis software. The pre-requirements are given below for this demo.

Pre-requirements

  • NI-VISA Software[1]

  • Scilab[2]

  • Equalis Instrument Control Module[3]

  • Rigol DS4024 Digital Oscilloscope[4]

  • Microchip MPLAB X[5]

  • Microchip MCLV Board and the associated BLDC Motor[6]

  • Microchip ICD 3 In-Circuit Debugger/Programmer[7]

At this point, please have a look at the blog post Embedded Coder Module [8], because we will use the system described in it as signal sources

Equalis Instrument Control Module[3] VISA[9] functions are given below which will be used in this demo

  • VISA_open(visa_id , resource_descriptor)

This function opens a VISA session

  • VISA_write(visa_id, text_message)

This function sends a text_message to the instrument connected with the visa_id

  • data = VISA_read(visa_id, buffer_size)

The function reads the data from an instrument after a command is sent to the instrument with VISA_write()

SCPI[10] commands of Rigol DS4024 Digital Oscilloscope[4] are given below which will be used in this demo

  • *IDN?

Return instrument id

  • :MEASure:VAVG? CHAN

Return average value of signal on selected channel

  • :MEASure:PERiod? CHAN

Return period of signal on selected channel

  • :WAV:MODE Mode

Select waveform reading mode

  • :WAVeform:FORMat Format

Select waveform return format

  • :WAV:SOURce CHAN

Select source channel to read waveform

  • :WAVeform:DATA?

Return waveform from previously selected channel by :WAV:SOURce

Perform Demonstration

Now we assume that Microchip MCLV board was loaded with the program as in the blog Equalis Embedded Coder Module Part 2 – Sensored Brushless DC Motor Control[8]

Overall system can be seen on Fig.-1

Overall system

Figure-1 Overall system

Rigol DS4024 Digital Oscilloscope[4] is connected with USB and it can be checked if it is functional via NI MAX Measurement and Automation Explorer[1]. The instrument descriptor can be seen on Fig-2.

NI MAX Measurement and Automation Explorer

Figure-2 NI MAX Measurement and Automation Explorer

Now we can connect the instrument via connection GUI. This GUI can be found the demos in Equalis Instrument Control Module[3].

After start the GUI, two GUI will be opened, Connection GUI and Main GUI as in Fig.-3. We select connect item from the menu on Connection GUI, and enter instrument descriptor obtained from NI MAX[1], click OK then enter a VISA session ID between 1-30. Then instrument will be ready to data acquisition.

Connection GUI and Main GUI before connection

Figure-3 Connection GUI and Main GUI before connection

Now we can go to Main GUI, we selected to be displayed channels via check-boxes, and enter VISA session ID previously entered on Connection GUI. Now click Start button, we can see data on the GUI as displayed in the screen of the oscilloscope as in Fig.-4.

Connection GUI and Main GUI after established connection and data acquisition

Figure-4 Connection GUI and Main GUI after established connection and data acquisition

When we click Stop button, data acquisition will be terminated and measured values will be stored in a file and in Scilab[2] Workspace. This data can be used for further analyzes or plotted.

A demo can be found like that in that blog on demos in Equalis Instrument Control Module[3]. Also you can find a demo regarding Embedded Code Generation in Equalis Xcos Coder and Embedded Coder Module[11].

References

Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page