MOBILE HOME Technical Tips


Updated on 6/2/2015
The PIC16F876A
programmed with PETIT FAT reads bitmap file on the SD card and displays it on the TFT module. The firmware works for SD cards only because you can format FAT16 on max 2GB card. SD card interface the PIC in SPI mode.
Petit FAT file system reads one file only. It is configured to FAT16, FAT32 can be added. This pic doesn't have enough RAM for Write File option. Read more at
LCD TFT Module used is 8 bits drive. It includes SD card socket and 3.3V regulator. Inputs to the TFT driver are level shifted from 5V to 3.3V by buffers, inputs to the SD card are driven by resistors to reduce the drive to 3.3V .
The pic firmware can read only bitmap file of 24 bits bmp type. The file has to be size of 240 pixels width and 320 pixels high. The firmware removes the bitmap header (54 bytes) and then streams the rest of the file to the TFT. Every 3 bytes are the 24 bits color for one pixel. The bitmap format reads and displays the pixels of the image starting from bottom left.
Small color coded squares on the screen indicate errors: yellow for SD error, blue for file system error and green for file errors.
Format the card with FAT16.
Create image file using MS Paint or another program, file size is 226KB, image size 320 pixels high by 240 pixels wide.
Name the file "pic.bmp".
Save the file as 24 bits bmp.
Add the file to the root folder of the card (don't use a directory).


This project uses the same circuit with different firmware. It doesn't include Petit FAT. The program displays BMP pictures from the SD/SDHC card formatted FAT32. The code has functions that find the root directory, read the files location from the Root Directory and streams the data to the TFT. The code displays the files in rotation. The software can read only FAT32 and only from the root directory. The file name and size isn't read.
To setup the SD/SDHC card: format the card with FAT32, add files to root folder without directories. Each picture file size is 226KB, image size 320 pixels high by 240 pixels wide, saved as 24 bits bitmap. Files names have to be 8.3 type, 8 characters max. File can be created using MS Paint.

More about FAT32 in this document:
Good free specifications for SD can be found in SanDisk PDF:
You are free to use the circuit diagram and software with no limitations.


Circuit Description
See also Technical Tips

RD input of 3.3V is taken from the TFT module.
The module supply is 5V. The LCD driver I have is ILI9341.
I bought this module directly from China because the price was more sensible. It is important to note that most products sold on the net by Chinese are defective, you only have to hope that the one you receive after 4 weeks is only the second hand one and not the one that partly defective or doesn't work at all. Whichever way it is, forget about refund. Don't buy from when you order small quantity they label you as not valuable customer and send you rubbish out of their bin.


Comments and questions

Copy the number from the picture It stops net-robots from adding comments.

31.05.2017 - 03:50
Name: Moty
Comment: Hi Djalltra, Try these 2 websites, It takes a few hours to learn the basics and when you are successful in your code it surprises you how simple FAT is.

30.05.2017 - 04:14
Name: djalltra
Comment: hi 😃 moti I've searched all over the Web for tutorials on fat32 and fat16 file system and it seems like your the best looking at how you write your codes it shows your have a clear understanding about fat/fat32 file system could you please do a tutorial about the topic it would really help a lot because I don't always fancy copy codes but to understand them the links you please really don't help much in understanding the topic thanks

19.11.2015 - 00:07
Name: Moty
Comment: Hi Nichole. fat() follows the rules of FAT32 to find the location of the data on the disk (SD card). The first sector of the disk (MBR) has the info where the tables and the root folder are. When formatting the disk FAT32 selects the sectors for the data depending on the size of the disk. You can study the details and rules of FAT32 by clicking the link on this page. FAT is a simple file system and easy to learn.

18.11.2015 - 17:46
Name: nichole
Comment: hi moty is me nichole please i really want you to throw more light on the (void fat() )

18.11.2015 - 17:42
Name: Nichole
Comment: i love your works

04.09.2015 - 09:18
Name: hseyin
Comment: hi moty. how are u ? 2 will be questions 1) do{WriteSD();}while(!Rec); // for holding down the record button 2) How should automatically stop playback finished?