“true” case structure will be executed.
There is nothing inside its false case. To
place a case structure down on the block
diagram: functions > programming >
structures > case structure; then, drag it
over the data logging section. This is how
you can have a main while loop that
executes at a fast rate (100 mS), and yet
the data logging can occur at much
The Time Target numeric
control on the front panel will
respond immediately even though
the data logging may occur at much
longer intervals. In frame 1 (inside
the data logging case structure) is a
date and time icon: functions >
programming > timing > Get
Date/Time String. Coming out of its
top right connection is the date;
coming out of its bottom right
connection is the time; both are
data strings. The T constant on the left side makes it so
that it sends the seconds out with the time, as well as the
hour and minutes.
In frame 2, there is a number to decimal string
conversion icon: functions > string > number/string
conversions > number to decimal string. This converts the
orange DBL number coming from the temperature into a
pink or string data type. This is necessary since the date
and time are strings, and the temperature needs to be in a
string data type too. The item in frame 3 is a build array
icon which has been “stretched,” clicked, and expanded
down to allow three strings to come into it and then come
out as a one-dimensional array wired into the 1D data
terminal of the write to the delimited
spreadsheet icon. The options on the
write to the delimited spreadsheet icon
are set as before: T for append to file, and
the file name and location. However, the
delimiter (\t) option has a constant with a
space “ “ in it. If this is not done, the date,
time, and temperature will all be saved
together without any spacing between
them. This makes it more difficult to
read the file and bring it into a
Figure 22 shows the MyRIO file
with the date, time, and
temperatures logged with spaces
between them. Figure 23 shows
how this file was opened in Excel,
with column titles added.
Details about the Get Date/
Time String function should be
mentioned here. The date and time
strings come from the MyRIO itself.
The MyRIO does have a real time clock and calendar in it.
However, there is evidently no battery to run these when
the unit is powered down. So, if you want the actual date
and time, you will need to connect to the MyRIO unit
through a USB cable and a PC (again using Explorer) with
an address of 172.22.11.2. Set the correct date and time
before running a VI which uses these. This will need to be
done each time the unit is powered up.
Everything needed to make a complete temperature
control and data logging system has now been presented.
The last article next month will demonstrate how to
combine all of these individual VI’s functions together to
make a complete system. NV
March 2017 35
Development Tools and Learning Systems for
PICBASIC PRO™ Compiler
PICBASIC PRO is a trademark of Microchip Technology Inc. in the USA and other countries.
PIC is a registered trademark of Microchip Technology Inc. in the USA and other countries.
Check out our popular products for PIC® developers including:
PICBASIC PRO 3.0 Compiler
ME Labs Trainer Board and Programming Tutorial
ME Labs has been been a global leader in the creation of
development tools for PIC microcontrollers for 20 years.
Contact us at firstname.lastname@example.org or go to melabs.com