You can write PLC data to Excel files an the SD card using the functions Create Delimited Line to structure a line, and Write Delimited Line to send it to a specified Excel file on an SD Card.
Note ♦ |
Note that the main EXCEL folder and subfolders EXCEL0, EXCEL1, EXCEL2, EXCEL3 can each contain 64 files, for a total of 320 .csv files. |
♦ |
The .csv file name cannot exceed 8 characters. It may include only English characters and numbers: 0 - 9, A - Z, a - z, and the underscore character "_". |
Use this function to select PLC data, including numeric data and text strings, structure it, and save the resulting line to a vector of operands.
Defining a Line
Each row in the table displayed under Input will be a cell in the Excel line.
Click the Add Row icon to open the Excel Field dialog box.
Click a tab to select the type of data.
Click the Delimiter cells to select a Delimiter character that is different from the default.
Add and delete row by using the icons at the top of the function
Type |
Parameter |
Purpose |
Source: Define Data |
Field |
Use this to specify data for a cell in the Excel line. |
|
Delimiters |
Control characters that delimit the data for that cell |
Target: Data Buffer |
SD: Start of Vector, Create .csv Line |
Select the operand that will be start of the vector the function uses to store the data selected for the line, plus its delimiters. Use this operand for the function Write Delimited Line |
|
SD: Max Vector Length, Create .csv Line (bytes) |
Sets the maximum length of the vector in bytes. |
|
SD: Final # of bytes, Create .csv Line |
Reports the actual number of bytes sent to the vector |
Status |
SD: Create .csv Line Status Messages |
This is a bitmap; a bit turns ON to indicate status. It is initialized when the function starts.
|
Use Write Delimited Line to pull the data from the vector used by Create Delimited, and use it to write to (or create) an Excel file in this folder, or in one of four sub-folders.
Notes ♦ |
Write Delimited Line pulls data from the vector in chunks of 512 bytes, and writes this entire 512 bytes to the SD card. Write Delimited line is not linked in any way to Create Delimited Line. In Create Delimited Line, the parameters SD: Max Vector Length and SD: Final # of bytes, do not influence Write Delimited line. |
♦ |
Use SB 344,Write delimited line to SD in Progress, as a condition to running the function. |
Type |
Parameter |
Purpose |
Source |
Start of Vector |
Use the operand that is the Start of Vector for the Create Delimited Line function. |
Target |
Select SD folder |
This is where the line will be stored on the SD card. You can select the folder, or provide the Folder number via register. Values point to folders as follows: 10=the main Excel folder, 1000= Excel1, 1001= Excel2, 1002= Excel3, and 1003= Excel4. |
|
File Name |
Either enter a name, or link an operand to provide a file name. Note that you MUST provide a file name. If the linked register is empty, the file will not be created to the SD. If the folder does not contain a file of that name, the function will create one. |
|
File Extension |
Select .txt or csv |
Status |
SD: Write .csv Line Status Messages |
This is a bitmap; a bit turns ON to indicate status. It is initialized when the function starts.
|
|
Success Bit |
Turns ON when line is successfully written |