单片机编程php,STC单片机内部FLASH读写程序(最新整理)
《STC單片機內部FLASH讀寫程序(最新整理)》由會員分享,可在線閱讀,更多相關《STC單片機內部FLASH讀寫程序(最新整理)(6頁珍藏版)》請在人人文庫網上搜索。
1、STC 單片機內部 FLASH 讀寫程序(http:/control.blog.sina.com.cn/admin/article/article_add.php)電子伙伴 發表于 2006-4-11 16:26:001推 薦/i nclude STC89C51.h/i nclude #define ERROR0#define OK1#define WAIT_TIME0x00/mcu clock 40mhz/#define WAIT_TIME0x01/mcu clock 20mhz/#define WAIT_TIME0x02/mcu clock 10mhz/#define WAIT_TIME0。
2、x03/mcu clock 5mhz#define HOUR0x8000 #define MINUTE 0x8001void ISP_EN(void)EA = 0;/關中斷ISP_CONTR = ISP_CONTR & 0x18;/ 0001,1000ISP_CONTR = ISP_CONTR | WAIT_TIME;ISP_CONTR = ISP_CONTR | 0x80;/ 1000,0000void ISP_DI(void)ISP_CONTR = ISP_CONTR & 0x7f;/ 0111,1111 ISP_TRIG = 0x00;EA=1;/ 開中斷unsigned char By。
3、te_read(unsigned int byte_addr)ISP_ADDRH = (unsigned char)(byte_addr 8); ISP_ADDRL = (unsigned char)(byte_addr & 0x00ff);ISP_CMD= ISP_CMD & 0xf8;/ 1111,1000ISP_CMD= ISP_CMD | 0x01;/ 0000,0001字節讀數據存儲區ISP_EN();ISP_TRIG = 0x46; ISP_TRIG = 0xb9;_nop_();ISP_DI();return (ISP_DATA);void Sector_erase(unsign。
4、ed int Sector_addr)unsigned char addre;addre= (unsigned char)(Sector_addr 8);/ 1111,1110,0000,0000; 取扇區地址ISP_ADDRHISP_ADDRL= addre&0xfe;= 0x00;ISP_CMD =ISP_CMD & 0xf8;/ 1111,1000ISP_CMD =ISP_CMD | 0x03;/ 0000,0011扇區擦除數據存儲區ISP_EN();ISP_TRIG = 0x46;/ 觸發 ISP_IAP 命令ISP_TRIG = 0xb9;/ 觸發 ISP_IAP 命令_nop_()。
5、;ISP_DI();void Byte_program(unsigned int byte_addr, unsigned char DataBuf)ISP_ADDRH = (unsigned char)(byte_addr 8); ISP_ADDRL = (unsigned char)(byte_addr & 0x00ff);ISP_CMD= ISP_CMD & 0xf8;/ 1111,1000ISP_CMD= ISP_CMD | 0x02;/ 0000,0010字節編程數據存儲區ISP_DATA = DataBuf;ISP_EN();ISP_TRIG = 0x46;/ 觸發 ISP_IAP 。
6、命令ISP_TRIG = 0xb9;/ 觸發 ISP_IAP 命令_nop_();ISP_DI();unsigned char ByteProgramVerify(unsigned int byte_addr, unsigned char DataBuf)ISP_ADDRH = (unsigned char)(byte_addr 8); ISP_ADDRL = (unsigned char)(byte_addr & 0x00ff);ISP_CMD=ISP_CMD &0xf8;/ 1111,1000ISP_CMD=ISP_CMD |0x02;/0000,0010字節編程數據存儲區ISP_DATA。
7、=DataBuf;ISP_EN();ISP_TRIG ISP_TRIG_nop_();=0x46;0xb9;ISP_DATA=0x00;ISP_CMD=ISP_CMD &0xf8;/ 1111,1000ISP_CMD=ISP_CMD |0x01;/ 0000,0001ISP_TRIG = 0x46;/ 觸發 ISP_IAP 命令ISP_TRIG = 0xb9;/ 觸發 ISP_IAP 命令_nop_();ISP_DI();if(ISP_DATA=DataBuf) return OK; else return ERROR;“”“”At the end, Xiao Bian gives you a。
8、 passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning 。
9、can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you。
總結
以上是生活随笔為你收集整理的单片机编程php,STC单片机内部FLASH读写程序(最新整理)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php基础教程文档,PHP5基础教程
- 下一篇: 内存条性能大揭秘!老旧电脑秒变新机