Files / Access to FLASH #F
Commands to handle file access on the built-in FLASH.



Folder / Directory

Create folder

(File Directory Create)

#FDC

<Path>

Delete folder

(File Directory Delete)

#FDD

<Path>, Delete

Set working directory

(File Directory Set)

#FDS

<Path>

Send working directory

(File Directory Get)

#FDG


Send all folders and files (directory)

(File Directory Read binary)

#FDR

<Pfad> (act. working directory)

Send all folders and files (directory) (ASCII)

(File Directory read Ascii)

#FDA

<Pfad> (act. working directory)

Send all folders (directory)

(File Directory read dironly List)

#FDL

<Pfad> (act. working directory)

Files

Open file for writing

(File Write Open)

#FWO

<FileName>, Position [32-Bit] (End), Truncate(1), reserved Filesize(4096)

Close file (write operation)

(File Write Close)

#FWC

T

Set write position in file

(File Write Position)

#FWP

Position [32-Bit]

Write data to file

(File Write Data binary)

#FWD

Number [32-Bit], Binary data

Write ASCII-String to file

(File Write Ascii)

#FWA

"String"

Write Unicode-String to file

(File Write Unicode)

#FWU

"String"

Write register values to file

(File Write Register)

#FWR

Register-ID, ...

Write string register to file

(File Write Stringregister)

#FWS

String-ID, ...

Write array to file

(File Write Array)

#FWY

Array-ID, ...

Write binary data from register to file

(File Write Register binary)

#FWV

Typ, Register-ID, Register-ID+1, ...

Write binary data from numeric array to file

(File Write numeric Array binary)

#FWX

Typ, Array-ID, Startindex(0), Size(1), ...

Write binary data from string array to file

(File Write Stringarray binary)

#FWQ

Array-ID, Startindex(0), Size(1),

Open file for reading

(File Read Open)

#FRO

<FileName>, Position [32-Bit] (Start)

Close file (read operation)

(File Read Close)

#FRC

Time,Date,CRC16

Set read position in file

(File Read Position)

#FRP

Position [32-Bit]

Read and send data

(File Read Data binary)

#FRD

Number [32-Bit] (whole file)

Read ASCII string and write into string register

(File Read Ascii)

#FRA

String-ID, ...

Read Unicode string and write into string register

(File Read Unicode)

#FRU

String-ID, ...

Load data into register

(File Read Register)

#FRR

Register-ID, ...

Load data into string register

(File Read Stringregister)

#FRS

String-ID, ...

Read data (8-bit) and write into string register

(File Read Bytes to stringregister)

#FRB

String-ID, Number, Number [ID+1],...

Read data (16-bit) and write into string register

(File Read Words to stringregister)

#FRW

String-ID, Number, Number [ID+1],...

Read data into array

(File Read Array)

#FRY

Array-ID, ...

Read binary data into register

(File Read binary Data to register)

#FRV

Typ, Register-ID, Register-ID+1, ...

Read binary data into numeric array

(File Read binary Data to numeric array)

#FRX

Typ, Array-ID, Startindex(0), Size(1), ...

Read binary data into string array

(File Read binary Data to string array)

#FRQ

Array-ID, Startindex(0), Size(1),

Delete file

(File File Delete)

#FFD

<Filename>


General commands

Send file/folder information

(File File Info)

#FFI

<Path> (act. working directory)

Rename file/folder

(File File Rename)

#FFR

<Path>, <New Filename>, Replace (0)

Copy file/folder

(File File Copy)

#FFC

<Path>, <New Path>, Replace (0)

Move file/folder

(File File Move)

#FFM

<Path>, <New Path>, Replace (0)

Change time stamp of file/folder

(File change Timestamp)

#FFT

<Path>, Time, Date

Change attributes of file / folder

(File change Attribut)

#FFA

<Path>, Attribute

Calculate and save CRC16 in FAT

(File Set CRC16)

#FFS

<Path+Filename>, manual CRC16

Load file names into string register

(File Names Files to stringregister)

#FNF

<Path> (act. working directory), ID (1)

Load subdirectories into string register

(File Names Directory to stringregister)

#FND

<Path> (act. working directory), ID (1)

Load file names into string array

(File Names Files to stringarray)

#FNA

Array-ID, WritePointer(0), <Path>, Regex-ID

Load subdirectories into string array

(File Names Directory to stringarray)

#FNB

Array-ID, WritePointer(0), <Path>, Regex-ID

Format SD card / Remove encryption

(File enKryption Format)

#FKF

<Format.all>

Folder / Directory

Create folder

#FDC

<Path>

The command creates a new folder. The <Path> parameter specifies the name and location.

...

#FDC <Project/NewPath>

...


Delete folder

#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

...


Set working directory

#FDS

<Path>

The command sets the current working directory. With path </> you reach the root directory.

...

#FDS <Project>

...


Send working directory

#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

...


Send all folders (directory)

#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

Open file for writing

#FWO

<FileName>, Position [32-Bit] (End), Truncate(1), reserved Filesize [32bit] (4096)

The command opens (write only) or creates a file. The Position (32-bit value) indicates the write position in the file. The reserved Filesize is the size that is reserved for the file in flash. The file can not exceed this size.

Truncate

0

Overwrite data

1

Truncate old data


Close file (write operation)

#FWC

Time, Date, CRC16

The command closes an open file (write operation). The writing process is completed and it is ensured that all data has been written.

Optionally the file time and date can be set (details see command #FFT).

The CRC16 can be used to check the file integrity. The module can calculate crc16 with the help of calculations.


Set write position in file

#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()


Write data to file

#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.


Write ASCII-String to file

#FWA

"String"

The command writes an ASCII string (8 bits per character) into the open file.

...

#FWO <Project/File.txt>

#FWA "Hello World"

#FWC

...


Write Unicode-String to file

#FWU

"String"

The command writes a Unicode string (16 bits per character) into the open file.

...

#FWO <Project/File.txt>

#FWU "Hello World"

#FWC

...


Write register values to file

#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

#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

#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

#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

#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.


Open file for reading

#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.



Close file (read operation)

#FRC

The command closes an open file (read operation).


Set read position in file

#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()


Read and send data

#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).


Load data into register

#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

#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

#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

#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

#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).


Delete file

#FFD

<Filename>

The command deletes a file (<Filename>)

General commands


Send file/folder information

#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()


Rename file/folder

#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


Copy file/folder

#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


Move file/folder

#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()


Calculate and save CRC16 in FAT

#FFS

<Path+Filename>, manual crc16

The command sets the CRC16 to the file filename. It's possible to write a manually calculated crc16.


Load file names into string register

#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

#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

#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

#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).


Formats FLASH memory

#FKF

<Format.all>

The SD card or FLASH will be formatted. Attention: all data will be lost and the encryption will be removed. The parameter must be specified exactly identical.