完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
这个程序用来实现液晶时钟,编译时出" error C193: '/': bad operand type",请问错在那里啊,怎么该这个错。
程序如下: #include #include #include #define uchar unsigned char #define unit unsigned int ***it T_CLK = P1^3; ***it T_IO = P1^4; ***it T_RST = P1^2; ***it RS = P1^7; ***it RW = P1^6; ***it EN = P1^5; ***it key0 = P3^0; ***it key1 = P3^1; ***it key3 = P3^2; ***it ACC7 = ACC^7; ***it ACC0 = ACC^0; uchar datechar[] = {"DATE:"}; uchar timechar[] = {"TIME:"}; uchar datebuffer[8] = {0,0,0x2d,0,0,0x2d,0,0}; uchar timebuffer[8] = {0,0,0x3a,0,0,0x3a,0,0}; uchar data ttime[3] = {0x00,0x00,0x00}; uchar data tdata[3] = {0x00,0x00,0x00}; void WriteB(uchar ucDa) { uchar i; ACC = ucDa; for(i=8;i>0;i--) { T_IO = ACC0; T_CLK = 1; T_CLK = 0; ACC = ACC >> 1; } } uchar ReadB(void) { uchar i; for(i=8;i>0;i--) { ACC = ACC >> 1; ACC7 = T_IO; T_CLK = 1; T_CLK = 0; } return(ACC); } void V_W1302(uchar ucAddr,uchar ucDa) { T_RST = 0; T_CLK = 0; _nop_ (); _nop_(); T_RST = 1; _nop_(); _nop_(); WriteB(ucAddr); WriteB(ucDa); T_CLK = 1; T_RST = 0; } uchar uc_R1302(uchar ucAddr) { uchar ucDa = 0; T_RST = 0; T_CLK = 0; T_RST = 1; WriteB(ucAddr); ucDa = ReadeB(); T_CLK = 1; T_RES = 0; return(ucDa); } void fbusy() { P2 = 0xff; RS = 0; RW = 1; EN = 1; EN = 0; while((P2 & 0x80)) { EN = 0; EN = 1; } } void wc51r(uchar j) { fbusy(); EN = 0; RS = 0; RW = 0; EN = 1; P2 = j; EN = 0; } void wc51ddr(uchar j) { fbusy(); EN = 0; RS = 1; RW = 0; EN = 1; P2 = j; EN = 0; } void init() { wc51r(0x01); wc51r(0x38); wc51r(0x0c); wc51r(0x06); } void delay(uint i) { uint y,j; for(j=0;j { for(y=0;y<0xff;y++){;} } } void main(void) { uchar i,set; uchar data temp; SP = 0x50; delay(10); init(); wc51r(0x80); for(i=0;i<5;i++) wc51ddr(datechar[i]); wc51r(0xc0); for(i=0;i<5;i++) wc51ddr(timechar[i]); while(1) { P3 = 0xFF; if(key0 == 0) { delay(10); if(key0 == 0) { while(key0 == 0); set++; if(set == 6) set=0; } } if(key1 == 0) { delay(10); if(key1 == 0) { while(key1 == 0); switch(set) { case 1: tdata[0]++; if(tdata[0] == 100) tdata[0] = 0; temp = (tdata[0]/10)*16 + tdata[0]%10; V_W1302(0x8e,0); V_W1302(0x8c,temp); V_W1302(0x8e,0x80); break; case 2: tdata[1]++; if(tdata[1] == 13) tdata[1] = 1; temp = (tdata[1]/10)*16 + tdata[1]%10; V_W1302(0x8e,0); V_W1302(0x88,temp); V_W1302(0x8e,0x80); break; case 3: tdata[2]++; if(tdata[2] == 32) tdata[2] = 1; temp = (tdata[2]/10)*16 + tdata[2]%10; V_W1302(0x8e,0); V_W1302(0x86,temp); V_W1302(0x8e,0x80); break; case 4: ttime[2]++; if(ttime[2] == 24) ttime[2] = 0; temp = (ttime[2]/10)*16 + ttime[2]%10; V_W1302(0x8e,0); V_W1302(0x84,temp); V_W1302(0x8e,0x80); break; case 5: ttime[1]++; if(ttime[1] == 60) ttime[1] = 0; temp = (ttime[1]/10)*16 + ttime[1]%10; V_W1302(0x8e,0); V_W1302(0x82,temp); V_W1302(0x8e,0x80); break; } } } if(key2 == 0) { delay(10); if(key2 == 0) { while(key2 == 0); switch(set) { case 1: tdata[0]--; if(tdata[0] == 0xff) tdata[0] = 99; temp = (tdata[0]/10)*16 + tdata[0]%10; V_W1302(0x8e,0); V_W1302(0x8c,temp); V_W1302(0x8e,0x80); break; case 2: tdata[1]--; if(tdata[1] == 0x00) tdata[1] = 12; temp = (tdata[1]/10)*16 + tdata[1]%10; V_W1302(0x8e,0); V_W1302(0x88,temp); V_W1302(0x8e,0x80); break; case 3: tdata[2]--; if(tdata[2] == 0x00) tdata[2] = 31; temp = (tdata[2]/10)*16 + tdata[2]%10; V_W1302(0x8e,0); V_W1302(0x86,temp); V_W1302(0x8e,0x80); break; case 4: ttime[2]--; if(ttime[2] == 0xff) ttime[2] = 23; temp = (ttime[2]/10)*16 + ttime[2]%10; V_W1302(0x8e,0); V_W1302(0x84,temp); V_W1302(0x8e,0x80); break; case 5: ttime[1]--; if(ttime[1] == 0xff) ttime[1] = 59; temp = (ttime[1]/10)*16 + ttime[1]%10; V_W1302(0x8e,0); V_W1302(0x82,temp); V_W1302(0x8e,0x80); break; } } } temp = uc_R1302(0x8d); tdata[0] = (temp/16)*10 + temp%16; datebuffer[0] = 0x30 + temp/16; datebuffer[1] = 0x30 + temp%16; temp = uc_R1302(0x89); tdata[1] = (temp/16)*10 + temp%16; datebuffer[3] = 0x30 + temp/16; datebuffer[4] = 0x30 + temp%16; temp = uc_R1302(0x87); tdata[2] = (temp/16)*10 + temp%16; datebuffer[6] = 0x30 + temp/16; datebuffer[7] = 0x30 + temp%16; temp = uc_R1302(0x85); temp = temp & 0x7f; ttime[2] = (temp/16)*10 + temp%16; timebuffer[0] = 0x30 + temp/16; timebuffer[1] = 0x30 + temp%16; temp = uc_R1302(0x83); ttime[1] = (temp/16)*10 + temp%16; timebuffer[3] = 0x30 + temp/16; timebuffer[4] = 0x30 + temp%16; temp = uc_R1302(0x81); temp = temp & 0x7f; ttime[0] = (temp/16)*10 + temp%16; timebuffer[6] = 0x30 + temp/16; timebuffer[7] = 0x30 + temp%16; wc51r(0x86); for(i=0;i<8;i++) wc51addr(datebuffer[i]); wc51r(0xc6); for(i=0;i<8;i++) wc51ddr(timebuffer[i]); } } |
|
相关推荐
6个回答
|
|
只能告诉你是数据类型除了问题
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
不是我打击你哈 我把你的程序复制了一下试试 结果这错报的都不知道多少个了 你确定只有这么一个错误么 我是真的让你无奈了 学学模块化编程吧 程序更明了 没有这么难看了。
|
|
|
|
zhoukai16702969 发表于 2015-12-10 16:24 我运行是只是只有数据类型这个错误,不过我重新弄过,现在弄好了 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
《DNESP32S3使用指南-IDF版_V1.6》第三十五章 摄像头实验
757 浏览 0 评论
《DNESP32S3使用指南-IDF版_V1.6》第三十章 DHT11数字温湿度传感器
728 浏览 0 评论
826 浏览 0 评论
【敏矽微ME32G070开发板免费体验】之原厂2812测试例程解析
1459 浏览 0 评论
1208 浏览 2 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12058 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 08:05 , Processed in 0.801852 second(s), Total 50, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号