User Manual

Programming made easy
6.4 Easy to create data logs
Easy Book
112 Manual, 03/2014, A5E02486774-AF
Duty cycle can be expressed, for example, as a
percentage of the cycle time or as a relative quantity
(such as 0 to 1000 or 0 to 10000). The pulse width can
vary from 0 (no pulse, always off) to full scale (no
pulse, al
ways on).
Cycle time
Pulse width time
The PWM output can be varied from 0 to full scale, providing a digital output that in many
ways is the same as an analog output. For example, the PWM output can be used to control
the speed of a motor from stop to full speed, or it can be used to control position of a valve
from closed to fully opened.
6.4
Easy to create data logs
Your control program can use the Data log instructions to store run-time data values in
persistent log files. The data log files are stored in flash memory (CPU or memory card). Log
file data is stored in standard CSV (Comma Separated Value) format. The data records are
organized as a circular log file of a pre-determined size.
The Data log instructions are used in your program to create, open, write a record, and close
the log files. You decide which program values will be logged by creating a data buffer that
defines a single log record. Your data buffer is used as temporary storage for a new log
record. New current values must be programmatically moved into the buffer during run-time.
When all of the current data values are updated, you can execute the DataLogWrite
instruction to transfer data from the buffer to a data log record.
You can open, edit, save, rename, and delete data log files from the File Browser page of
the Web Server. You must have read privileges to view the file browser and you must have
modify privileges to edit, delete, or rename data log files.
Use the DataLog instructions to programmatically store run-time process data in flash
memory of the CPU. The data records are organized as a circular log file of a pre-
determined size. New records are appended to the data log file. After the data log file has
stored the maximum number of records, the next record written overwrites the oldest record.
To prevent overwriting any data records, use the DataLogNewFile instruction. New data
records are stored in the new data log file, while the old data log file remains in the CPU.
Table 6- 21 DataLogWrite instruction
LAD/FBD
SCL
Description
"DataLogWrite_DB"(
req:=_bool_in_,
done=>_bool_out_,
busy=>_bool_out_,
error=>_bool_out_,
status=>_word_out_,
ID:=_dword_inout_);
DataLogWrite writes a data record into the specified data log.
The pre-existing target data log must be open.
You must programmatically load the record buffer with current
run-time data values and then execute the DataLogWrite
instruction to move new record data from the buffer to the data
log.
If there is a power failure during an incomplete DataLogWrite
operation, then the data record being transferred to the data log
could be lost.