free software platform for real-time control and measurement application development

MicroDAQ Toolbox for Scilab

MicroDAQ toolbox for Scilab is a free software package which gives engineers and scientists tool for creating real-time control and measurement applications. As a alternative for commercial solutions toolbox features automatic code generation from block diagram, data acquisition functionality, legacy C code integration tools and many more.  

Data acquisition

MicroDAQ toolbox for Scilab can be used to develop advanced data acquisitions applications. Toolbox lets you make a variety of measurements directly from Scilab without the need to convert the data or import from other software. Software includes functions for controlling analog inputs, analog outputs, digital I/O (quadrature encoders, PWM). You can visualize and analyze data, automate measurements, create wireless measurement applications and a lot more with MicroDAQ toolbox for Scilab.

The toolbox also provides scanning functions which allow to acquire data from analog inputs and generate a signal on analog output simultaneously. This enables a user to create a variety of data acquisition applications - from simple 2-line of code analog input acquisition application for more sophisticated where analog input and output are used simultaneously.

mdaqAIScanInit(1:8, [-10,10], %F, 10000, 1) // 10kHz data acqisition on eight analog input channels
plot(mdaqAIScan(10000, %T)); // start acqisition and read data

Analog input scanning can be executed in blocking and non-blocking mode. Analog output scanning supports two modes - periodic and stream. In periodic mode signal generated on analog output uses a single buffer which can be updated during the scanning session. This way a user can generate independent signals on analog output and update sample data during signal generation. The stream mode allows generating analog signals from stream type data queued by the user during the scanning session. This mode can be used to perform real-time audio stream filtering. For more info on MicroDAQ toolbox and data acquisition visit online help.

DSP application generation from block diagram

MicroDAQ toolbox for Scilab features automatic code generation from Xcos diagram. The user can build block diagram and generate DSP application in minutes without having in-depth knowledge about hardware. Generated DSP application can be loaded on MicroDAQ with WiFi or Ethernet automatically. Toolbox generates periodic applications with a frequency defined by the user. Depending on the model complexity and used blocks, a generated application can be executed with up to 200kHz on MicroDAQ DSP core giving user possibility to create advanced digital signal processing, control, and measurement application.  

Figure 1: Code generation process

The toolbox provides different MicroDAQ blocks which allows access to MicroDAQ hardware. The user can use access analog inputs/outputs, digital I/O, PWM, Quadrature Encoder. The MicroDAQ palette also provides special blocks which are used to setup model and access live data from generated DSP application. The generated application meets real-time constraints which are critical in control and signal processing applications. This toolbox feature is available only with MicroDAQ E2000 series and can be an alternative for expensive commerial solutions.

Figure 2: MicroDAQ Xcos blocks

Legacy and custom C code integration

MicroDAQ toolbox for Scilab allows easy integration of custom C/C++ code making Xcos model development more flexible. The user can automatically generate Xcos blocks which executes custom C/C++ code. The user can optimize some parts of Xcos model by replacing standard Xcos block with a custom block which contains optimized C code for faster execution. Especially C/C++ programmers will benefit from code integration tools which give easy way to write custom Xcos block which sometimes is easier than making it with standard Xcos blocks. Together with 'Execution profiling' feature which allows precisely determine model execution times C Code integration tools allows model optimization and customization. 

adc_block = mdaqBlock(); = "ADC2"; 
adc_block.desc = ["This block read MicroDAQ analog inputs"]; 
adc_block.param_name = ["ADC"; "Channel"; "Read count"]; 
adc_block.param_size = [ 1; 1; 1 ]; 
adc_block.param_def_val(1) = [ 1 ]; 
adc_block.param_def_val(2) = [ 1 ]; 
adc_block.param_def_val(3) = [ 1 ]; = []; 
adc_block.out = [1]; 

Model execution profiling

MicroDAQ toolbox for Scilab provides tools for target execution profiling. This tool gives a clear answer about model execution times which in a real-time application is very crucial. By knowing the model time budget user can decide to optimize most time-consuming parts of the Xcos model by replacing it with a custom block which executes optimized C code. Execution profiling tools can give an answer what is the maximum model sample rate. See ADC performance measurement with execution profiling article to find out more about this feature.  

Figure 3: Model execution time for every model step on MicroDAQ DSP

Utilizing XCos generated application with LabView

It is possible to integrate XCos generated DSP application with external tools and applications. LabView is one of the examples, it can be used to create GUI interface which will allow accessing live DSP data and parameters. This approach allows combining real-time processing on MicroDAQ DSP with LabView interface flexibility. To find out more about this feature read C/C++ code utilization with MicroDAQ VIs. To lear more read Interfacing DSP core from LabView.