Experiment Using MicroDAQ-Data Acquisition Tool
Experiment Using MicroDAQ-Data Acquisition Tool
Experiment Using MicroDAQ-Data Acquisition Tool
M.Mohamed Ibrahim
Tenet Technetronics
13-MAY-17
Tenet Technetronics 1
Application Notes
Contents
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 2
Application Notes
1.1 MicroDAQ
MicroDAQ is an ideal platform for developers, scientists and geeks
involved in real-time measurement and control development. The platform
supports design flows from popular model based tools like SCILAB, MATLAB, and
LABVIEW. The user has the choice to either go with a complete open source
software toolchain or with the existing access to proprietary tools in the house.
Figure 1: MicroDAQ
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 3
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 4
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 5
Application Notes
Ethernet
Wi-Fi
USB2.0
32 DIO lines
8 analog inputs
8 analog outputs
Step 2:
Data exchange between MicroDAQ and host PC is done with Ethernet or Wi-Fi.
Connect the device using Ethernet.
Step 3:
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 6
Application Notes
Connect the USB Port of the MicroDAQ device to the host PC. Microdaq device
will discovered as the USB storage device.
Step 4:
Open the USB storage device and open network.txt file. Configure the IP
address.
Ethernet - 10.10.1.1
Wi-Fi - 10.10.2.1
If you want setup host PC with MicroDAQ default IP settings you should use the
following IP address and network mask settings for your host PC:
Control panel -> Network and sharing center -> Access type (Local area
connections) ->Properties -> Internet protocol version 4
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 7
Application Notes
Figure 4
Set IP address from 10.10.1.2 - 10.10.1.254 and subnet mask as 255.255.255.0 and
press ok
Step 5: open cmd window then command ping 10.10.1.2 and check whether
we are getting reply.
Figure 5
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 8
Application Notes
Figure 6
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 9
Application Notes
Figure 7
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 10
Application Notes
1. Standalone mode
2. Ext mode
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 11
Application Notes
Step 2: Objective is to create an XCOS model using MicroDAQ LED blocks (see
Figure 3). Pick all the blocks specified in the fig 2, set the appropriate parameters
and make the connections as shown in the diagram.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 12
Application Notes
Step 3: Now, we need to change the mode of MicroDAQ. Select SETUP Block
and make changes as shown in Figure 4.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 13
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 14
Application Notes
Step 5: After build model, select Tools MicroDAQ load model (see Figure 6)
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 15
Application Notes
Step 7: After upload model (See Figure 8), Application will be stored in a MicroDAQ
nonvolatile memory.
Step 8: Let us connect power source and see how our standalone DSP
application works (see Figure 9,10).
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 16
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 17
Application Notes
In Ext mode user can use execution profiling feature to measure model
execution times.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 18
Application Notes
3.1 Introduction
We can control and configure function generator directly from SCILAB_XCOS using
MicroDAQ Toolbox. We can create the waveforms in SCILAB_XCOS and use the toolbox
to upload them to the instrument. We can also build graphical interfaces to verify
device performance, compare real-world data to models created in SCILAB_XCOS
and automate the tests.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 19
Application Notes
application
User defined
Super block
function/super_f
Clock MicroDAQ/Sources/clock_c
Visualization MicroDAQ/sinks/cscope
Step 2: Make connection between the required blocks and then simulate the diagram
to get a sine and square waveform.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 20
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 21
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 22
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 23
Application Notes
Gain Block:
Workspace Block:
This block is used to put simulated data in the scilab workspace. Each sampling time,
both dates and values of input are recorded. Records are available after the simulation
in Scilab's workspace as variable.time and variable.values where variable is the name
given in the Scilab variable name field.
OUTPUT:
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 24
Application Notes
After simulation,
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 25
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 26
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 27
Application Notes
Method 1:
Step 2: Objective is to create an XCOS model using MicroDAQ DAC and ADC
blocks (see Figure 6). Pick all the blocks specified in the fig 6b, set the
appropriate parameters and connect as shown in the diagram.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 28
Application Notes
Note:
Sine block gives an output in volts to DAC Block, so we are giving an analog sine wave
as input to DAC block. Connect MicroDAQ AO1 pin and GND to CRO. Now you can
visualize the generated Sine wave in CRO (See figure 7).
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 29
Application Notes
Step 3: Connect potentiometer as analog input through the pin AI1in MicroDAQ
(see Figure 8).
Step 4: Connect LED to analog output pin AO1 in MicroDAQ (See Figure 9).
Simulate the model. Now the output plots for ADC & DAC Blocks are displayed
(see Figure 10).
During positive half cycle of sine wave LED glows and negative half cycle LED
turns off.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 30
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 31
Application Notes
Method 2:
Step1: Replace the input of the ADC, potentiometer with sine wave as input by
shorting the pins AI1 and AO1 in the MicroDAQ hardware module.
Step 2: Now simulate the model observe for changes in graph as shown in figure.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 32
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 33
Application Notes
5.1 Introduction
This block controls MicroDAQ PWM modules. One of three PWM modules can be
selected (PWM1, PWM2, PWM3), PWM period is defined with 1us resolution, 'Polarity'
parameters allow to generate inverted PWM waveform. Blocks input parameter range
is 0-100 (duty in %).
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 34
Application Notes
Step 2: Objective is to create an XCOS model using MicroDAQ PWM blocks (see
Figure 2a). Pick all the blocks specified in the fig 2b, set the appropriate
parameters and connect as shown in the diagram.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 35
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 36
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 37
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 38
Application Notes
CHAP 6: Encoder
6.1 Introduction
Encoders are used to translate rotary or linear motion into a digital signal. Usually this is
for the purpose of monitoring or controlling motion parameters such as speed, rate,
direction, distance or position.
Here, we can use MicroDAQ Encoder Block to count rotation of DC motor directly from
SCILAB_XCOS. We can also build graphical interfaces to verify device performance,
compare real-world data to models created in SCILAB_XCOS.
This powerful brushed DC gear motor is available in six different gear ratios and features
an integrated quadrature encoder with 64 counts per revolution (CPR) of the motor
shaft.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 39
Application Notes
6.3 Encoder
A two-channel Hall Effect encoder is used to sense the rotation of a magnetic disk on a
rear protrusion of the motor shaft. The quadrature encoder provides a resolution of 64
counts per revolution of the motor shaft, which corresponds to 1920 counts per
revolution of the gearboxs output shaft.
The motor/encoder has six color-coded, 11" (28 cm) leads terminated by a 16 female
header with a 0.1 pitch, as shown in the Figure 2.
The Hall sensor requires an input voltage, Vcc, between 3.5 and 20 V and draws a
maximum of 10 Ma. The A and B outputs are square waves from 0 V to Vcc
approximately 90 out of phase. The frequency of the transitions tells you the speed of
the motor, and the order of the transitions tells you the direction.
Figure 2: Encoder
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 40
Application Notes
This block can be used in host simulation mode and for code generation.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 41
Application Notes
Step 1: MicroDAQ blocks are used to access the MicroDAQ hardware. MicroDAQ
bocks are available in XCOS palette browser under MicroDAQ palette.
Figure 6a
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 42
Application Notes
Figure 6b
Figure 6c
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 43
Application Notes
Note:
Here, we use gear motor so,we need to give 12v supply externally.
Figure 8: Output
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 44
Application Notes
7.1 Introduction
Code integration tools are useful for creating high performance real-time control and
measurement applications. C/C++ programmers will benefit from code integration tools
giving easy way to write custom Xcos block.
MicroDAQ toolbox for Scilab allows easy integration of legacy or custom C/C++ code
making Xcos model creation more flexible. User can automatically generate Xcos
blocks which executes custom C/C++ code.
Moreover block code can also be debugged with Code Composer Studio. User can
optimize some parts of Xcos model by replacing Xcos standard block with custom
block which contains optimized C code for faster execution.
ii. How to create custom ADC block with oversampling feature for getting
ADC reads more accurate.
}
Function sin_waveform_gen() returns sin value depending on user parameters values
The function sin_waveform_gen() returns sine value depending on the user parameters
passed through pointer. Depending on needs we can create Xcos block which will
execute sin_waveform_gen() function with different input and parameter options, like
amplitude, bias and frequency inputs and sin value output or create block which will
have frequency parameter and amplitude and bias input.
Tenet Technetronics | R&D LAB
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 45
Application Notes
MicroDAQ toolbox for Scilab provides macros which simplifies custom code integration
as a Xcos block.
2. Xcos block C code has to be modified to call custom code, in our case it is
sin_waveform_gen() function.
MicroDAQ toolbox for Scilab provides following macros which are used for custom
code integration and increase Xcos model flexibility.
To create default Xcos block structure mdaq_block() macro needs to be called from
Scilab console:
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 46
Application Notes
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 47
Application Notes
After calling mdaq_block_add macro we will have generated block macros and block
C code which will be executed on MicroDAQ DSP core. The macro generates only
block C code template, user has to edit generated file in order to call custom or legacy
code. More advanced Scilab users can edit block macros to change block
functionality. In our case we don't need to modify generated block macros, only C
code has to be modified to call sin_waveform_gen().
The generated mdaq_sin2.c file contains C code which is executed during model
initialization, calculation and model termination. There are three functions init(), inout()
end end(), these function are executed during model initialization, execution and
termination respectively.
Figure 1
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 48
Application Notes
In our case initialization function isn't used, only inout() function will be used to compute
sin_waveform_gen(). Generated code contains input, output and parameters
variables, generated variables names are the same as defined in Scilab structure
describing block. Block input variables are named with 'u' and number related to input
count. Block outputs on the other hand are need with 'y' and number of output, e.g 'y1'.
Generated function with input, output and block parameter variables looks as follows:
/* Block parameters */
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 49
Application Notes
Generated code contains comments which can give a hint where and how to add
custom code. In order call our sin_waveform_gen() function we will use u1, u2 input
variables and y1 output port variable. For frequency we will use frequency variable
which holds value provided by user in Xcos block properties. Our function call can look
as follows:
ii. we can create separate C source file & corresponding header file
and copy it to userlib directory and in mdaq_sin2.c file include header file. Scilab
mdaq_block_build() macro will compile every C source (generated and copied) file
which is located in userlib directory. In order to compile modified mdaq_sin2.c file
mdaq_block_build macro needs to be executed
mdaq_block_build();
If macro execution doesn't returns any error we can restart Scilab to have access to
newly created sin2 block. After Scilab restart new palette MicroDAQ User appears in
palette browser with sin2 block. Generated block has two inputs and one output as
described in sin_block structure before. Block sin2 also has Frequency parameter for
determining sine waveform frequency with default value 1.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 50
Application Notes
Figure 2
We need to verify if our generated block works as expected. In order to do this we will
create simple model with generated block and scope for verification. We can use
generated block same as standard Xcos blocks, after code generation with Tools-
>MicroDAQ build and load model we can see on scope if our generated block works
as expected.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 51
Application Notes
Figure 3
We can also change frequency from default 1 to 10 and add bias to the waveform
with created custom block.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com
Tenet Technetronics 52
Application Notes
Figure 4
This example shows how user can integrate custom C code as a Xcos block in a Xcos
diagram and generate from it DSP applicaion which can be executed on MicroDAQ
device. This way MicroDAQ toobox code integration tools allows easy integration of
user code by filling out a structure with basic block parameters and block C code
modification to obtain custom block executing user C code. In the next example we
see how to customize MicroDAQ hardware blocks by implementing custom ADC block
with oversampling feature.
2514/U, 7th Opp:B.B.M.P. Swimming Pool, 8th A Main Rd, Hampi Nagar, RPC Layout, Vijaya Nagar, Bengaluru-560104
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com