USB interface (X002)
A USB flash drive can be connected to the USB interface and used as an additional memory. The USB interface supports transfer speeds of up to 12 Mbit/s and no more than 100 mA. The file is accessed from TwinCAT or the PLC program with the help of the associated function blocks. No other devices can be connected to the USB interface and used.
The same functional mode can be used for accessing files on the MicroSD card. Use C:\ as the drive letter for accessing the MicroSD card and D:\ for accessing the USB flash drive.
Function blocks for data access
The function blocks can be used to process files from the PLC locally on the PC. The TwinCAT target system is identified by the AMS network address. This mechanism makes it possible, amongst other things, to store or to edit files on other TwinCAT systems in the network. Access to files consists of three sequential phases:
- Opening the file.
- Read or write access to the opened file.
- Closing the file.
Opening the file has the purpose of establishing a temporary connection between the external file, whose name is all that initially is known, and the running program. Closing the file has the purpose of indicating the end of the processing and placing it in a defined output state for processing by other programs.
Name | Description |
---|---|
FB_EOF | Check the end of file |
FB_FileOpen | Open a file |
FB_FileClose | Close a file |
FB_FileGets | Get string from a file |
FB_FilePuts | Put string to a file |
FB_FileRead | Read from a file |
FB_FileWrite | Write to a file |
FB_FileSeek | Move the file pointer |
FB_FileTell | Get the file pointer position |
FB_FileDelete | Delete a file |
FB_FileRename | Rename a file |
FB_CreateDir | Create new directory |
FB_RemoveDir | Remove directory |
Requirements
Development environment |
Target system type |
PLC libraries to include (Category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_System (System) |