Topic: DMD0386 File System Reference |
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
As of version 2.0, all of the Do-more CPUs include one or more file systems and a suite of instructions that allow users to create new files, read and write data in existing files, setup event-based, and time-based data logging to files, backing up the PLC's contents to a micro-SD Card, and restoring part or all of a PLC's project from a micro-SD card. Do-more PLCs have two file systems; the ones available depend on the family of hardware: @RamFS All Do-more CPUs will have this file system available.
@SDCardFS Do-more CPUs that have a micro-SD card slot will use this file system on the removable media in that slot.
Note: Because the Do-more file system supports long file names, any time the filename is longer that 8 characters in the name plus 3 characters in the file extension, the entry in the FAT (file allocation table) for this file will use the long file name format. This format will get the required additional space for the file name from the FAT. The result of using long file names is there wont be space in the FAT for the full complement of files and folders. The exact number of files and folders that can be created in a folder is largely dependent on how long the file and folder names are.
File System UtilitiesDo-more Designer includes a utility program called Browse PLC File Systems that can be used to view and change the contents of the two file systems. You can browse the contents of the folders on the file system, copy files from the PLC to the PC running Do-more Designer and from the PC down to the PLC. You can also delete files on the PLC file system. As of now this is the only way to get files onto one of the file systems in the CPUs from a PC.
You can Backup some or all of the contents of the PLC to micro-SD using the BACKUP - System Backup instruction or the Create PLC Image File utility. The image file created by the system backup processed can be restored from a micro-SD card during a reboot. That process is also described in the Backup and Restore using micro-SD Card help topic.
You can also use the EMAIL - Send Email instruction to send a file from either of the file systems as an attachment to an email message.
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
Instruction Set for File OperationsThe Do-more CPUs have a full suite of instructions for managing files and folders on the file systems.
FILECLOSE - Close File - close access to a file that was previously open.
FILECOPY - Copy File - make a copy of the contents of a file on one of the file systems to a second file on one of the file systems.
FILEDEL - Delete File - remove an existing file or an existing directory from one of the file systems.
FILELOG - Log to File - store PLC data in a file at a recurring interval or when triggered by an event.
FILENEWFLDR - Make New Folder - create a folder on one of the existing file systems.
FILEOPEN - Open File - open an existing file or create a new file on one of the existing file systems and create a File Handle that will be used by other FILE instructions.
FILEQUERY - Query File or Folder Information - retrieve status information about the files and folders on a file system.
FILEREAD - Read from File - retrieve data from a file that has been opened with the FILEOPEN - Open File instruction.
FILESEEK - Seek to Position in File - manually move the file pointer forward (toward the end of the file) or backward (toward the beginning of the file).
FILESYSCMD - Perform File System Command - is used to execute system level functions on the RAM and SDCard file systems, for example Format, Eject, Mount, etc.
FILETRUNC - Truncate File - delete the contents of the specified file from the current location of the file pointer to the end of the file.
FILEWRITE - Write to File - send data to a file that has been opened with the FILEOPEN - Open File instruction.
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
File System StructureEach file system has an associated structure that contains the following member fields which can be used in the ladder logic to perform system-level operations and to make sure the file system is ready for use before an attempt is execute any of the file instructions.
Each File System structure contains the following member fields which can be used in the ladder logic.
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
File Handle StructureA File Handle is memory that contains information about the current state of a file on one of the PLC File Systems. Each time a Open File (FILEOPEN) instruction is executed the File Handle structure is initialized. As other File System instructions are used to operate on the file, the contents of the File Handle structure are updated. The contents of the structure's fields will remain valid until a Close File (FILECLOSE) instruction is executed for the File Handle.
Each File Handle structure contains the following member fields which are used by some of the other File System instructions to read and write the contents of the file:
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
File System Error Codes:Improper use of any FILE instruction or any file system hardware problem will generate a warning message at runtime. When any of these warnings are generated, the On Error parameter in the instruction will be ON and the System ERR variable will contain one of the following text messages. You will also be alerted to this condition by yellow "Warning" text displayed in the Status Bar of Do-more Designer. Clicking that text will open the System Status to display the full text of the warning message.
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
See Also
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
Related TopicsEMAIL - Send Email (with file attachment)
Backup and Restore using micro-SD Card
|
|||||||||||||||||||||||||||
|