Jump to content

Component: FAT Dummy (File)

From Flowcode Help
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. FAT Read File File:Test.txt


Console showing current 512 byte sector data


Console showing high level FAT status


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. FAT display Bitmap Demo bitmap files referenced in the example.

File:FATDemoBitmaps.zip


Picture showing a bitmap being displayed on a GLCD component.


Data logger Simple

Example showing how to take a collection of analogue readings and save them into a text based file, the simple way. 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. 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. 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. WAV Streaming






Macro reference

AppendByteToFile

AppendByteToFile
 
- BYTE Data
 
- BYTE Return


AppendStringToFile

AppendStringToFile
 
- STRING Data_String
 
- BYTE Return


CloseFile

CloseFile
 
- VOID Return


CreateFile

CreateFile
 
- STRING Filename
 
- BYTE Return


DeleteFile

DeleteFile
 
- STRING Filename
 
- BYTE Return


MoveToNextFileSector

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 
- BYTE Force_Next_Sector
 
- BYTE Return


OpenFile

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


OpenFolder

OpenFolder
 
- STRING Folder_Name
 
- BYTE Return


ReadByteFromFile

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). 
- UINT Return


ReadByteFromIndex

ReadByteFromIndex
Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer.  
- ULONG Address
 
- BYTE Return


ReadFileLength

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 
- INT Return


ReadFileSize

ReadFileSize
Reads the entire size of the current file in bytes. 
- ULONG Return


WriteByteToBuffer

WriteByteToBuffer
 
- UINT Address
 
- BYTE Data
 
- VOID Return


WriteFileSector

WriteFileSector
 
- BYTE Return


Property reference

Properties