很久之前學習PIC的時候找的資料,對讀寫SD卡很有幫助!!!
實物圖:
closeup.jpg (203.38 KB, 下載次數: 119)
下載附件
2017-12-19 19:16 上傳
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
diagram.jpg (106.8 KB, 下載次數: 117)
下載附件
2017-12-19 19:16 上傳
front.jpg (142.71 KB, 下載次數: 103)
下載附件
2017-12-19 19:16 上傳
rear.jpg (164.25 KB, 下載次數: 130)
下載附件
2017-12-19 19:16 上傳
單片機源程序如下:
- /***************************************************
- PIC18F SD/MMC Bitmap File Reader
- May 2010
- *****************************************************/
- #include <htc.h>
- #include <string.h>
- #define _XTAL_FREQ 48000000
- #pragma config FOSC = HSPLL_HS
- #pragma config PLLDIV = 5 // (20 MHz crystal on PICDEM FS USB board)
- #pragma config CPUDIV = OSC1_PLL2 // Clock source from 96MHz PLL/2
- #pragma config PWRT = ON
- #pragma config BOR = ON
- #pragma config BORV = 2
- #pragma config WDT = OFF
- #pragma config DEBUG = ON
- #pragma config LVP = OFF
- #define TRUE 1
- #define FALSE 0
- #include "pff.h"
- #include "lcd3310.h"
- #include "lcd_bmp.h"
- FATFS Fs; /* File system object */
- DIR Dir; /* Directory object */
- FILINFO Fno; /* File information */
- void delay(void);
- void main(void)
- {
- BYTE res, i;
- while(1){
- delay();
- lcd_init();
- lcd_clear();
- lcd_text(0,1, "PIC BMP Reader");
- lcd_text(0,3, "insert SDcard!");
- if (pf_mount(&Fs) ) continue; /* Initialize FS */
- lcd_text(0,3, " initialized ");
- delay();
- delay();
- while(1){
- if (pf_opendir(&Dir, "")) break; // open root directory
- while (!pf_readdir(&Dir, &Fno) && Fno.fname[0]) {
- if( strstr(Fno.fname, ".BMP") ){ // BMP file
- if(pf_open(Fno.fname)) continue; // open file
- draw_bitmap(Fno.fname);
- delay();
- delay();
- delay();
- }
-
- }
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
0.jpg (10.94 KB, 下載次數: 122)
下載附件
2017-12-19 19:17 上傳
所有資料51hei提供下載:
PIC18-SD-BMP-Reader.rar
(1.03 MB, 下載次數: 48)
2017-12-19 10:31 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|