- /**********SD卡控制端定义**************/
- #define SD_CS_0 P4OUT&=~BIT5
- #define SD_CS_1 P4OUT|=BIT5
- /******SD_DI-->P3.1,SD_DO-->P3.2,SD_CLK-->P3.3****/
- /**************************************/
- uchar CMD0[6]={0x40,0x00,0x00,0x00,0x00,0x95};//切换到SPI模式命令
- uchar CMD1[6]={0x41,0x00,0x00,0x00,0x00,0x01};//初始化命令
- uchar CMD16[6]={0x50,0x00,0x00,0x02,0x00,0x01};//设置扇区大小512BYTE
- uchar CMD17[6]={0xfe,0x00,0x00,0x00,0x00,0x01};//从SD卡中单个块读取数据命令,中间四个字节为地址
- uchar CMD24[6]={0x58,0x00,0x00,0x00,0x00,0xff};//向SD卡中单个块写入数据命令,中间四个字节为地址
复制代码 |