Files / SD-Card access #F
Commands to handle file access on the built-in SD-Card
Folder / Directory
Create folder (File Directory Create) |
<Path> |
|
Delete folder (File Directory Delete) |
<Path>, Delete |
|
Set working directory (File Directory Set) |
<Path> |
|
Send working directory (File Directory Get) |
||
Send all folders and files (directory) (File Directory Read binary) |
<Pfad> (act. working directory) |
|
Send all folders and files (directory) (ASCII) (File Directory read Ascii) |
<Pfad> (act. working directory) |
|
Send all folders (directory) (File Directory read dironly List) |
<Pfad> (act. working directory) |
Files
Open file for writing (File Write Open) |
<FileName>, Position [32-Bit] (End), Truncate(1) |
|
Close file (write operation) (File Write Close) |
||
Set write position in file (File Write Position) |
Position [32-Bit] |
|
Write data to file (File Write Data binary) |
Number [32-Bit], Binary data |
|
Write ASCII-String to file (File Write Ascii) |
"String" |
|
Write Unicode-String to file (File Write Unicode) |
"String" |
|
Write register values to file (File Write Register) |
Register-ID, ... |
|
Write string register to file (File Write Stringregister) |
String-ID, ... |
|
Write array to file (File Write Array) |
Array-ID, ... |
|
Write binary data from register to file (File Write Register binary) |
Typ, Register-ID, Register-ID+1, ... |
|
Write binary data from numeric array to file (File Write numeric Array binary) |
Typ, Array-ID, Startindex(0), Size(1), ... |
|
Write binary data from string array to file (File Write Stringarray binary) |
Array-ID, Startindex(0), Size(1), |
|
Open file for reading (File Read Open) |
<FileName>, Position [32-Bit] (Start) |
|
Close file (read operation) (File Read Close) |
||
Set read position in file (File Read Position) |
Position [32-Bit] |
|
Read and send data (File Read Data binary) |
Number [32-Bit] (whole file) |
|
Read ASCII string and write into string register (File Read Ascii) |
String-ID, ... |
|
Read Unicode string and write into string register (File Read Unicode) |
String-ID, ... |
|
Load data into register (File Read Register) |
Register-ID, ... |
|
Load data into string register (File Read Stringregister) |
String-ID, ... |
|
Read data (8-bit) and write into string register (File Read Bytes to stringregister) |
String-ID, Number, Number [ID+1],... |
|
Read data (16-bit) and write into string register (File Read Words to stringregister) |
String-ID, Number, Number [ID+1],... |
|
Read data into array (File Read Array) |
Array-ID, ... |
|
Read binary data into register (File Read binary Data to register) |
Typ, Register-ID, Register-ID+1, ... |
|
Read binary data into numeric array (File Read binary Data to numeric array) |
Typ, Array-ID, Startindex(0), Size(1), ... |
|
Read binary data into string array (File Read binary Data to string array) |
Array-ID, Startindex(0), Size(1), |
|
Delete file (File File Delete) |
<Filename> |
General commands
Send file/folder information (File File Info) |
<Path> (act. working directory) |
|
Rename file/folder (File File Rename) |
<Path>, <New Filename>, Replace (0) |
|
Copy file/folder (File File Copy) |
<Path>, <New Path>, Replace (0) |
|
Move file/folder (File File Move) |
<Path>, <New Path>, Replace (0) |
|
Change time stamp of file/folder (File change Timestamp) |
<Path>, Time, Date |
|
Change attributes of file / folder (File change Attribut) |
<Path>, Attribute |
|
Load file names into string register (File Names Files to stringregister) |
<Path> (act. working directory), ID (1) |
|
Load subdirectories into string register (File Names Directory to stringregister) |
<Path> (act. working directory), ID (1) |
|
Load file names into string array (File Names Files to stringarray) |
Array-ID, WritePointer(0), <Path>, Regex-ID |
|
Load subdirectories into string array (File Names Directory to stringarray) |
Array-ID, WritePointer(0), <Path>, Regex-ID |
|
Remove encryption (File enKryption Format) |
<Format.all> |
Folder / Directory
#FDC |
<Path> |
The command creates a new folder. The <Path> parameter specifies the name and location.
... #FDC <Project/NewPath> ... |
#FDD |
<Path>, Delete |
The command deletes a folder. The <Path> parameter specifies the name and location.
Delete |
|
0 |
Delete folder and content |
1 |
Delete content only |
... #FDD <Project/NewPath>,0 ... |
#FDS |
<Path> |
The command sets the current working directory. With path </> you reach the root directory.
... #FDS <Project> ... |
#FDG |
|
The command places the current working directory in the send buffer. The feedback is structured as follows:
ESC |
F |
D |
G |
Path |
... |
|
$1B |
$46 |
$44 |
$47 |
'String' completed with $00 |
Send all folders and files (directory)
#FDR |
<Pfad> (act. working directory) |
The command places all folders and files of the current working directory in the send buffer. The feedback is structured as follows:
ESC |
F |
D |
R |
Path/ Filename |
Size |
Attribute |
Time |
Date |
... |
Ending |
$1B |
$46 |
$44 |
$52 |
'String' completed with $00 |
32-Bit value |
8-Bit value |
16-Bit value |
16-Bit value |
$00 |
Attribute |
|
$01 |
Read only |
$02 |
Hidden |
$04 |
System |
$20 |
Archive |
... #FDR ... |
Send all folders and files (directory) (ASCII)
#FDA |
<Pfad> (act. working directory) |
The command places all folders and files of the current working directory in the send buffer as ASCII strings.
ESC |
F |
D |
A |
String |
Ending |
... |
$1B |
$46 |
$44 |
$41 |
Size, Attribute, Time, Date, Name |
CRLF |
... #FDA ... |
#FDL |
<Pfad> (act. working directory) |
The command places all folders of the current working directory in the send buffer. The feedback is structured as follows:
ESC |
F |
D |
L |
Directory-name |
Ending |
||
$1B |
$46 |
$44 |
$4C |
'String' completed with $00 |
$00 |
Files
#FWO |
<FileName>, Position [32-Bit] (End), Truncate(1) |
The command opens (write only) or creates a file. The Position (32-bit value) indicates the write position in the file.
Truncate |
|
0 |
Overwrite data |
1 |
Truncate old data |
#FWC |
|
The command closes an open file (write operation). The writing process is completed and it is ensured that all data has been written.
#FWP |
Position [32-Bit] |
The command sets the write Position (32-bit value) at the specified position in the file. If the value is <0, the position is calculated from the end of the file
See also fposW()
#FWD |
Number [32-Bit], Binary data |
The command writes a Number (32-bit value) of Binary data to the opened file. This command is unsuitable for macro programming. It is used to transfer binary data via the interface.
#FWA |
"String" |
The command writes an ASCII string (8 bits per character) into the open file.
... #FWO <Project/File.txt> #FWA "Hello World" #FWC ... |
#FWU |
"String" |
The command writes a Unicode string (16 bits per character) into the open file.
... #FWO <Project/File.txt> #FWU "Hello World" #FWC ... |
#FWR |
Register-ID, ... |
The command writes the register value (Register-ID) to the open file. The value can be read out with the #FRR command. 5 bytes are required for each register.
Write string register values to file
#FWS |
String-ID, ... |
The command writes the content of the string register (String-ID) to the open file. The string can be read out with the command #FRS. 2 · (n + 1) bytes (n = number of letters) are required for each register.
Write array to file (from V1.4)
#FWY |
Array-ID, ... |
The command writes the content of the array (Array-ID) to the open file. The string can be read out with the command #FRY. For each integer or float array 6+4-n bytes (n=length of the array) are needed. A Unicode StringArray requires 11 + (Maximum Entrysize * Length of the array) bytes.
Write binary data from register to file (from V1.7)
#FWV |
Typ, Register-ID, Register-ID+1, ... |
The command writes the contents of the register (Register ID) in binary format to the open file. The register can be read out with the command #FRV.
Typ |
|||
7 |
Signed Byte |
1 Byte |
little endian |
8 |
Unsigned Byte |
1 Byte |
|
15 |
Signed Integer |
2 Byte |
|
16 |
Unsigned Integer |
2 Byte |
|
23 |
Signed Integer |
3 Byte |
|
24 |
Unsigned Integer |
3 Byte |
|
31 |
Signed Integer |
4 Byte |
|
32 |
Unsigned Integer |
4 Byte |
|
33 |
Float |
4 Byte |
|
115 |
Signed Integer |
2 Byte |
big endian |
116 |
Unsigned Integer |
2 Byte |
|
123 |
Signed Integer |
3 Byte |
|
124 |
Unsigned Integer |
3 Byte |
|
131 |
Signed Integer |
4 Byte |
|
132 |
Unsigned Integer |
4 Byte |
|
133 |
Float |
4 Byte |
Write binary data from numeric array to file (from V1.7)
#FWX |
Typ, Array-ID, Startindex(0), Size(1), ... |
The command writes the contents of a numeric array (Array ID) in binary format to the open file. The numeric array can be read out with the command #FRX.
Typ |
|||
7 |
Signed Byte |
1 Byte |
little endian |
8 |
Unsigned Byte |
1 Byte |
|
15 |
Signed Integer |
2 Byte |
|
16 |
Unsigned Integer |
2 Byte |
|
23 |
Signed Integer |
3 Byte |
|
24 |
Unsigned Integer |
3 Byte |
|
31 |
Signed Integer |
4 Byte |
|
32 |
Unsigned Integer |
4 Byte |
|
33 |
Float |
4 Byte |
|
115 |
Signed Integer |
2 Byte |
big endian |
116 |
Unsigned Integer |
2 Byte |
|
123 |
Signed Integer |
3 Byte |
|
124 |
Unsigned Integer |
3 Byte |
|
131 |
Signed Integer |
4 Byte |
|
132 |
Unsigned Integer |
4 Byte |
|
133 |
Float |
4 Byte |
Write binary data from string array to file (from V1.7)
#FWQ |
Array-ID, Startindex(0), Size(1), .. |
The command writes the contents of a string array (Array ID) in binary format to the open file. The string array can be read out with the command #FRQ.
#FRO |
<FileName>, Position [32-Bit] (Start) |
The command opens (read only) a file. The Position (32-bit value) indicates the read position in the file.
#FRC |
|
The command closes an open file (read operation).
#FRP |
Position [32-Bit] |
The command sets the read Position (32-bit value) at the specific position in the file. If the value is <0, the position is calculated from the end of the file
See also fposR()
#FRD |
Number [32-Bit] (whole file) |
The command reads a Number (32-bit value) of bytes from the open file and places the data in the send buffer. The feedback is structured as follows:
ESC |
F |
R |
D |
Number |
Data 1 |
Data 2 |
Data n |
... |
||
$1B |
$46 |
$52 |
$44 |
32-Bit value |
8-Bit value |
8-Bit value |
8-Bit value |
Read ASCII string and write into string register
#FRA |
String-ID, ... |
The command reads an ASCII string (8 bits per character) up to the character "\n" and stores it in a string register (String-ID).
Read Unicode string and write into string register
#FRU |
String-ID, ... |
The command reads a Unicode string (16 bits per character) up to the character "\n" and stores it in a string register (String-ID).
#FRR |
Register-ID, ... |
The command reads back a register written with #FRW and saves it in the register (Register-ID).
Load data into string register
#FRS |
String-ID, ... |
The command reads back a string register written with #FRS and saves it in the string register (String-ID).
Read data (8-Bit) and write into string register
#FRB |
String-ID, Number, Number [ID+1],... |
The command reads a Number (1 ... 250) of bytes and saves it in the string register (String-ID).
Read data (16-Bit) and write into string register
#FRW |
String-ID, Number, Number [ID+1],... |
The command reads a Number (1 ... 250) of Words and saves it in the string register (String-ID).
Read data into array (from V1.4)
#FRY |
Array-ID, ... |
The command reads back an array written with #FWY and saves it in the array (Array-ID).
Read binary data into register (from V1.7)
#FRV |
Typ, Register-ID, Register-ID+1, ... |
The command reads back a binary register written with #FWV and saves it in the register (Register-ID).
Typ |
|||
7 |
Signed Byte |
1 Byte |
little endian |
8 |
Unsigned Byte |
1 Byte |
|
15 |
Signed Integer |
2 Byte |
|
16 |
Unsigned Integer |
2 Byte |
|
23 |
Signed Integer |
3 Byte |
|
24 |
Unsigned Integer |
3 Byte |
|
31 |
Signed Integer |
4 Byte |
|
32 |
Unsigned Integer |
4 Byte |
|
33 |
Float |
4 Byte |
|
115 |
Signed Integer |
2 Byte |
big endian |
116 |
Unsigned Integer |
2 Byte |
|
123 |
Signed Integer |
3 Byte |
|
124 |
Unsigned Integer |
3 Byte |
|
131 |
Signed Integer |
4 Byte |
|
132 |
Unsigned Integer |
4 Byte |
|
133 |
Float |
4 Byte |
Read binary data into numeric array (from V1.7)
#FRX |
Typ, Array-ID, Startindex(0), Size(1), ... |
The command reads back a binary numeric array written with #FWX and saves it in the register (Array-ID).
Typ |
|||
7 |
Signed Byte |
1 Byte |
little endian |
8 |
Unsigned Byte |
1 Byte |
|
15 |
Signed Integer |
2 Byte |
|
16 |
Unsigned Integer |
2 Byte |
|
23 |
Signed Integer |
3 Byte |
|
24 |
Unsigned Integer |
3 Byte |
|
31 |
Signed Integer |
4 Byte |
|
32 |
Unsigned Integer |
4 Byte |
|
33 |
Float |
4 Byte |
|
115 |
Signed Integer |
2 Byte |
big endian |
116 |
Unsigned Integer |
2 Byte |
|
123 |
Signed Integer |
3 Byte |
|
124 |
Unsigned Integer |
3 Byte |
|
131 |
Signed Integer |
4 Byte |
|
132 |
Unsigned Integer |
4 Byte |
|
133 |
Float |
4 Byte |
Read binary data into string array (from V1.7)
#FRQ |
Array-ID, Startindex(0), Size(1), .. |
The command reads back a binary string array written with #FWQ and saves it in the register (Array-ID).
#FFD |
<Filename> |
The command deletes a file (<Filename>)
General commands
#FFI |
<Path> (act. working directory) |
The command puts all information about the folder / file (such as time stamp, size) in the send buffer. If the folder / file does not exist, an empty string is returned, the remaining parameters are no longer transferred. The feedback is structured as follows:
ESC |
F |
F |
I |
Directory-/ File-name |
Size |
Attribute |
Time |
Date |
... |
|
$1B |
$46 |
$46 |
$49 |
'String' completed with $00 |
32-Bit value |
8-Bit value |
16-Bit value |
16-Bit value |
See also fileS(), fileA(), fileT()
#FFR |
<Path>, <New Filename>, Replace (0) |
The command changes the specified <Path> to a new name (<New Filename> is only the new name, without path).
Replace |
|
0 |
Do not rename if folder / file already exists |
1 |
Delete existing folder / file and rename it |
#FFC |
<Path>, <New Path>, Replace (0) |
The command copies the specified folder, the specified file (<Path>) to a new location (<New Path>).
Replace |
|
0 |
Do not rename if folder / file already exists |
1 |
Delete existing folder / file and rename it |
#FFM |
<Path>, <New Path>, Replace (0) |
The command moves the specified folder, the specified file (<Path>) to a new location (<New Path>).
Replace |
|
0 |
Do not rename if folder / file already exists |
1 |
Delete existing folder / file and rename it |
Change time stamp of file/folder
#FFT |
<Path>, Time, Date |
The command changes the time stamp of the folder or the file (<Path>):
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Time |
Hour [0...23] |
Minute [0...59] |
Second/2 [0...29] |
|||||||||||||
Date |
Year (from 1.1.1980 0:0:0 Hour) [0...127] |
Month [1...12] |
Day [1...31] |
Example for calculation:
Time = (Hour<<11) + (Minute<<5) + (Second>>1);
Date = ((Year-1980)<<9) + (Month<<5) + Day;
See also fatT(datetime), fatD(datetime), fattime(Fat-Time, Fat-Date)
Change attributes of file/folder
#FFA |
<Path>, Attribute |
The command sets the Attributes of the folder / file. The attributes can be set simultaneously with bit coding.
Attribute |
|
$01 |
Read only |
$02 |
Hidden |
$04 |
System |
$20 |
Archive |
See also fileA()
Load file names into string register (from V1.1)
#FNF |
<Path> (act. working directory), ID (1) |
The command saves all file names from the <Path> in the string register (String-ID = ID ... IDn). The number is stored in the register (Register ID = ID). (You can search with patterns ?/* e.g. * .txt stores all text files)
Load subdirectories into string register (from V1.1)
#FND |
<Path> (act. working directory), ID (1) |
The command saves all folder names that are in the <Path> in the string register (String-ID = ID ... IDn). The number is stored in the register Rregister ID = ID). (You can search with patterns ?/*, e.g. *New* stores all directories in which the word "New" occurs)
Load file names into string array (from V1.7)
#FNA |
Array-ID, WritePointer(0), <Path>, Regex-ID |
The command saves all folder names that are in the <Pfad> in the string array (Array-ID).
Load subdirectories into string array (from V1.7)
#FNB |
Array-ID, WritePointer(0), <Path>, Regex-ID |
The command saves all folder names that are in the <Pfad> in the string array (Array-ID).
#FKF |
<Format.all> |
The SD card, encrypted by uniTFTDesigner, will be formatted (Attention: all data will be lost) and the encryption will be removed. The parameter must be specified exactly identical.