![]() ![]() ![]() SD card driver and FAT16 library for CCS must be added to the project, just by putting the two source codes in the project folder or the CCS driver folder. ![]() The microcontroller runs at 48MHz (8MHz + PLL). The C code below was tested with CCS PIC C compiler versions 5.051 and 5.070. Read and display text file from FAT16 microSD card using PIC18F4550 C code: ![]() The chip select pin of the SD card is connected to pin RD3 (the SD card chip select pin is active low). I used just one wire (RD2) to transmit data from the microcontroller to the PC (there is no need for the MCU to receive data so the receiving wire is not connected). The MAX232 is used to interface our microcontroller with PC via serial port as what was done in this topic:ĬCS C UART example for PIC18F4550 microcontroller The MISO is connected directly to the SDI pin of the microcontroller because it is the data output pin of the SD card which is normally does not exceed 3.3V. The voltage divider consists of 3.3K and 2.2 K resistors. Also the outputs of the PIC18F4550 are logic 0 (0V) or logic 1 (5V) and connecting the microcontroller output pins (CS, SDO and SCK) directly to the SD card may damage it, here a voltage divider is used to get about 3V from the 5V which is enough for the SD card. As known the SD card voltage is 3.3V and the PIC18F4550 voltage is 5V, so AMS1117 3.3V is used to step down the 5V in order to supply our SD card. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |