16
CompactFlash Commands
Write Command
Publication LOGIX-AP007B-EN-P - January 2007
Set Up the Create Command
To set up the Create command, define the filename including the file
extension, for example, testfile1.dat. To execute the Create command, set the
execute_CF_Create_File bit. The application code resets this bit.
Refer to Chapter 4, Example Application for complete instructions.
Use the Write command to write data to the CompactFlash card. A file must
exist on the CompactFlash card before executing this command.
The Write command is broken into 11 commands:
• Data parsing
Only 450 bytes can be written at one time to the file. Therefore, writing
to the file is broken down into 450 byte chunks.
This moves the data into the data_to_write array from the data array in
the CF_Data_Working UDT, putting in the place holders for the
checksums. It also verifies that all arrays used are large enough to handle
the data.
• checksum calculations
This calculates the checksum for each 450 byte chunk of data and places
it into the place holders created in Data parsing.
• The file is open.
• The file pointer is set.
• The data is written.
• The file is closed.
• The file is opened.
• The file is read.
Only 450 bytes can be read at one time from the file. Therefore, reading
from the file is broken down into 450 byte chunks. This moves the data
into the data_read array.