完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
#include
#include #define uchar unsigned char #define uint unsigned int #define com XBYTE[0x 7f00] #define pa XBYTE[0x 7f01] #define pb XBYTE[0x 7f02] #define pc XBYTE[0x 7f03] #define led1 P1 #define led2 P2 ***it iom=P1^7; uchar table[]={0xc0,0xf9,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x18,0x08,0x03,0x46,0x21,0x06,0x0e,0x7f}; bit press() uchar read() uchar display(uchar row) void delay(uint xms) { uint i,j; for(i=xms;i>0;i--) for(j=110;j>0;j--); } bit press() { uchar hang; pc=0x00; hang=pa; if(hang!=0xff) return(1); else return(0); } uchar read() { uint t; uchar hang,lie,keyscan,j,value; value=0x00; if(press()==1) { delay(10) if(press()==1) { hang=0xfe; for(t=0;t<4;t++) { pc=hang; lie=pa; if(lie!=0xff) { for(j=0;j<8;j++) { if((lie&0x01)!=0x01) { keyscan=j+value; return(keyscan); } else { lie>>1; } } else { hang=(hang<<1)|0x01; value+=0x08; } } } return(0xff); } return(0xff); } } uchar display(uchar row) { uchar row1,row2; if(row==0xff) { led1=table[16]; led2=table[16]; } else { row1=row/10; row2=row%10; led1=table[row1]; led2=table[row2]; } } void main() { uchar row3; iom=1; com=0x0c; while(1) { row3=read(); display(row3); while(press()); delay(50); } } 通过KEIL编译后出现这样的错误提示,请各位大侠帮忙看看问题出在哪里? A.C(15): error C132: 'read': not in formal parameter list A.C(15): error C141: syntax error near 'unsigned' A.C(17): error C132: '_display': not in formal parameter list A.C(17): error C141: syntax error near 'void' A.C(18): error C132: '_delay': not in formal parameter list A.C(18): error C141: syntax error near '{' A.C(19): error C132: 'i': not in formal parameter list A.C(19): error C132: 'j': not in formal parameter list A.C(20): error C141: syntax error near 'for' A.C(20): error C141: syntax error near '=', expected ')' A.C(20): error C129: missing ';' before '>' a.c - 11 Error(s), 0 Warning(s). |
|
相关推荐
8个回答
|
|
|
|
|
|
|
|
|
|
声明函数后面需要加分号。如楼上所说
|
|
|
|
#include
#include #define uchar unsigned char #define uint unsigned int #define com XBYTE[0x7f00] #define pa XBYTE[0x7f01] #define pb XBYTE[0x7f02] #define pc XBYTE[0x7f03] #define led1 P1 #define led2 P2 ***it iom=P1^7; uchar table[]={0xc0,0xf9,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x18,0x08,0x03,0x46,0x21,0x06,0x0e,0x7f}; bit press(); uchar read(); void display(uchar row); void delay(uint xms) { uint i,j; for(i=xms;i>0;i--) for(j=110;j>0;j--); } bit press() { uchar hang; pc=0x00; hang=pa; if(hang!=0xff) return(1); else return(0); } uchar read() { uint t; uchar hang,lie,keyscan,j,value; value=0x00; if(press()==1) { delay(10); if(press()==1) { hang=0xfe; for(t=0;t<4;t++) { pc=hang; lie=pa; if(lie!=0xff) { for(j=0;j<8;j++) { if((lie&0x01)!=0x01) { keyscan=j+value; return(keyscan); } else { lie>>=1; } } } else { hang=(hang<<1)|0x01; value+=0x08; } } return(0xff); } return(0xff); } } void display(uchar row) { uchar row1,row2; if(row==0xff) { led1=table[16]; led2=table[16]; } else { row1=row/10; row2=row%10; led1=table[row1]; led2=table[row2]; } } void main() { uchar row3; iom=1; com=0x0c; while(1) { row3=read(); display(row3); while(press()); delay(50); } } |
|
|
|
这是修改的,你本意是想用8255芯片搞个矩阵键盘还是什么?
|
|
|
|
|
|
|
|
{:soso_e179:}已解决 |
|
|
|
问题已解决,谢谢你。 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
使用Keil建立完整的工程,并使用外部中断0触发数码管显示903
418 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-使用AHT20进行环境监测之AHT20传感器介绍
1083 浏览 0 评论
846 浏览 0 评论
886 浏览 1 评论
基于瑞萨FPB-RA4E2智能床头灯项目——1编译环境搭建与点亮驱动ws2812全彩LED
882 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11834 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-1 03:27 , Processed in 0.974013 second(s), Total 55, Slave 49 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号