- 1、本文档共19页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
sd卡读写程序(SD card read and write program)
sd卡读写程序(SD card read and write program)
SD card reader program
Objective: To study the SD card / / operation
Design / software
1, using SPI communication / / SD card
2, go to SD / / in order to 0-255 a total of 256 data, and then read back LCD1602 display
/ / hardware requirements:
S11 ON / / dial switch
Jumper J18 / / all connected
#include p30f6014.h //dsPIC30F6014 standard header file
_FOSC (CSW_FSCM_OFF XT_PLL4); //4 frequency doubling crystal Failsafe clock off
_FWDT (WDT_OFF); / / close the watchdog timer
_FBORPOR (PBOR_OFF MCLR_EN); / / reset prohibited MCLR reset enable.
_FGS (CODE_PROT_OFF); / / code protection against
#define CS PORTGbits.RG9 / / SD card selection pin definition
#define RS LATBbits.LATB4 / / definition LCD control bits (note here can only register with LATB, you cannot directly use the PORTB register)
#define RW LATBbits.LATB5
#define e LATBbits.LATB6
Unsigned char __attribute__ ((address (0x900))) lcd[3]={0,0,0};
Void (spi_init); / / declaration system initial function
Void (spi_low); / / that produces low baud rate (using the SD card initialization function)
Void (spi_high); / / that produce high baud rate function (SD card initialization after use)
Unsigned char (sd_reset); / / that the SD card initialization function
Unsigned char SD_SendCommand (unsigned char CMD unsigned, long ARG); / / write SD card command function statement
Unsigned char SPI_WriteByte (unsigned char VAL); / / write a byte function statement
Unsigned char SPI_ReadByte (void); / / that receive a byte function
Unsigned char SD_WriteSingleBlock (unsigned long sector); / / that single BLOCK data write SD card function
Unsigned char SD_ReadSingleBlock (unsigned long sector); / / read SD card data function single BLOCK statement
Void (lcd_display); / / state results display function
Void (delay); / / state delay function (shown by)
/ / system initialization function
Void (spi_init)
{
TRISG=0x00d0; / / set the SDI output, C output port for the other
TRISB=0X0000; / / se
您可能关注的文档
- photoshop钢笔路径使用技巧(Photoshop pen path using tips).doc
- php email正则验证(PHP email regular verification).doc
- php 正则表达式的模式修正符(Schema modifier for PHP regular expressions).doc
- php012 学生公寓信息管理系统(Php012 student apartment information management system).doc
- photoshop快捷键大全3(PS图象处理软件快捷键大全3).doc
- photoshop路径面板中的小技巧(Tips in the Photoshop path palette).doc
- phpcmsv9二次开发便捷自定义后台入口文件夹(Phpcmsv9 two development, convenient custom background entry folder).doc
- phpcms标签说明(Phpcms label description).doc
- pcb制版工艺流程(PCB plate making process).doc
- php各种编码集详解和在什么情况下进行使用(PHP various coding set, detailed and in what circumstances to use).doc
文档评论(0)