Component: FAT Dummy (File)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd.
Version 2.7
Category File


FAT Dummy component

FAT component allowing access to read and write files on a SD, SDHC or MMC card. The component automatically detects the filesystem on the card on initialise so FAT16 and FAT32 are fully supported.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_File_Dummy.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_File_Dummy.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Reading data from a text file

Example to read a text file from a SD card or from a text file in simulation and display on a 16 x 2 character LCD. The text file needs to be in the same directory as the Flowcode .fcfx project file for the simulation to run correctly. FC6 Icon.png FAT Read File File:Test.txt


Console showing current 512 byte sector data

FatBuffer.jpg


Console showing high level FAT status

FatStatus.jpg


Parsing a standard .BMP image file

Example to read a bitmap image file from a SD card or from a bitmap file in simulation and display on a graphical LCD. The bitmapfile needs to be in the same directory as the Flowcode .fcfx project file for the simulation to run correctly. FC6 Icon.png FAT display Bitmap Demo bitmap files referenced in the example.

File:FATDemoBitmaps.zip


Picture showing a bitmap being displayed on a GLCD component.

FatSimulatedBitmap.jpg


Data logger Simple

Example showing how to take a collection of analogue readings and save them into a text based file, the simple way. FC6 Icon.png FAT data logger simple but slow

Data logger Advanced

Example showing how to take a collection of analogue readings and save them into a text based file, the fast way. FC6 Icon.png FAT data logger fast

Log Keypad Presses

Example showing how to poll a keypad for key presses. Each key press is shown on an LCD and appended to a log file as an ASCII character using the FAT component. FC6 Icon.png Keypad Press Log

Streaming Audio Files

Example showing how to steam out .wav audio files from an SD card using a 16-bit @ 16KHz file format. A free program such as Audacity can be used to create or edit the .wav files. FC6 Icon.png WAV Streaming






Macro reference

AppendByteToFile

Fc9-comp-macro.png AppendByteToFile
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u8-icon.png - BYTE Return


AppendStringToFile

Fc9-comp-macro.png AppendStringToFile
 
Fc9-string-icon.png - STRING Data_String
 
Fc9-u8-icon.png - BYTE Return


CloseFile

Fc9-comp-macro.png CloseFile
 
Fc9-void-icon.png - VOID Return


CreateFile

Fc9-comp-macro.png CreateFile
 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


DeleteFile

Fc9-comp-macro.png DeleteFile
 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


MoveToNextFileSector

Fc9-comp-macro.png MoveToNextFileSector
Attempts to move to the next sector in the file. When reading a file you would leave force next sector set to 0. When writing a file you would leave force next sector set to 1 to allow new sectors to be created as the file grows. Returns 0 for success 
Fc9-u8-icon.png - BYTE Force_Next_Sector
 
Fc9-u8-icon.png - BYTE Return


OpenFile

Fc9-comp-macro.png OpenFile
Searches for and opens a file for reading or writing from within the current directory on the disk. Returns 0 for success. 
Fc9-string-icon.png - STRING Filename
8.3 filename of the file we are trying to open e.g. "file.txt" 
Fc9-u8-icon.png - BYTE Return


OpenFolder

Fc9-comp-macro.png OpenFolder
 
Fc9-string-icon.png - STRING Folder_Name
 
Fc9-u8-icon.png - BYTE Return


ReadByteFromFile

Fc9-comp-macro.png ReadByteFromFile
Reads a byte from the currently open file. Auto increments the position in the file. A return value of 0 may signify the end of the file has been reached (depending on the contents of the file). 
Fc9-u16-icon.png - UINT Return


ReadByteFromIndex

Fc9-comp-macro.png ReadByteFromIndex
Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer.  
Fc9-u32-icon.png - ULONG Address
 
Fc9-u8-icon.png - BYTE Return


ReadFileLength

Fc9-comp-macro.png ReadFileLength
Returns the number of bytes in the current sector that are used by the current open file. Return = 512 - Sector is filled with file data Return < 512 - Last sector of the file, Retval specifies how many bytes of data are remaining in the sector 
Fc9-s16-icon.png - INT Return


ReadFileSize

Fc9-comp-macro.png ReadFileSize
Reads the entire size of the current file in bytes. 
Fc9-u32-icon.png - ULONG Return


WriteByteToBuffer

Fc9-comp-macro.png WriteByteToBuffer
 
Fc9-u16-icon.png - UINT Address
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


WriteFileSector

Fc9-comp-macro.png WriteFileSector
 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties