No.72735 作者:jxcrg_t35 邮件:nczx24656@sina.com ID:147712 登陆:2次 文章数:1篇 最后登陆IP:121.10.139.197 最后登陆:2011/12/26 21:16:26 注册:2011/12/25 18:06:53 财富:106 发帖时间:2011/12/25 18:11:40 发贴者IP:121.10.139.199 标题:jxcrg_t35:X5045程序,什么问题,请大侠门看看 摘要:No.72735X5045程序,什么问题,请大侠门看看 #include <reg51.h> #include <intrins.h> #include <config.h> extern bit x5045useflag; void x5045_write_onebyte(unsigned char onedata){//只做时钟,不判断其他,在调用程序中加读写条件 unsigned char i; for(i=0;i <8;i++){ //上升沿写入SI x5045_si=(bit)(onedata&0x80); x5045_sck=0; onedata < <=1; x5045_sck=1; //SCK=1; } } unsigned char x5045_read_onebyte(void){//只做时钟,不判断其他,在调用程序中加读写条件 unsigned char i,onedata; for(i=0;i <8;i++){ //下降沿读入So x5045_sck=1; x5045_sck=0; //sck=0; onedata|=x5045_si; onedata < <=1; } return(onedata); } unsigned char x5045_read_status(void){ unsigned char temp; //***************************** x5045_so=1; x5045_si=1; //*****************************/ x5045_cs=0; x5045useflag=1; x5045_write_onebyte(RSDR); temp=x5045_read_onebyte(); x5045_cs=1; x5045useflag=0; return(temp); } void x5045_write_status(unsigned char vdata){ x5045_cs=0; x5045useflag=1; x5045_write_onebyte(WREN); x5045_cs=1; x5045_cs=0; x5045_write_onebyte(WRSR); x5045_write_onebyte(vdata); x5045_cs=1; x5045useflag=0; } void x504 ......
>>返回讨论的主题
|