找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

51中关于swith的用法

[复制链接]
admin 发表于 2012-9-2 08:15:21 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本人写了这个代码,问下错在哪里?51不能用swith吗
swith(judge)
{
case 0xd7:num=0;break;
case 0xea:num=1;break;
case 0xda:num=2;break;
case 0xaa:num=3;break;
case 0xed:num=4;break;
case 0xdd:num=5;break;
case 0xad:num=6;break;
case 0xee:num=7;break;
case 0xde:num=8;break;
case 0xae:num=9;break;
case 0xe7:num=10;break;//"on/cc"
case 0x77:num=11;break; //"+"
case 0x7a:num=12;break; //"-"
case 0x7d:num=13;break; //"x"
case 0x7e:num=14;break; //"/"
case 0xa7:num=15;break; //"="
default:;
}

运行后出错为:
BIT KEYBOARD.C(46): warning C276: constant in condition expression
BIT KEYBOARD.C(64): warning C206: 'swith': missing function-prototype
BIT KEYBOARD.C(64): error C267: 'swith': requires ANSI-style prototype
BIT KEYBOARD.C(65): error C141: syntax error near '{'
BIT KEYBOARD.C(66): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(66): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(67): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(67): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(68): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(68): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(69): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(69): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(70): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(70): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(71): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(71): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(72): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(72): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(73): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(73): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(74): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(74): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(75): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(75): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(76): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(76): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(77): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(77): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(78): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(78): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(79): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(79): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(80): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(80): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(81): error C172: 'case': missing enclosing switch
BIT KEYBOARD.C(81): error C171: 'break': missing enclosing loop
BIT KEYBOARD.C(82): error C172: 'default': missing enclosing switch
bit keyboard.c - 35 Error(s), 2 Warning(s).
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 08:58 , Processed in 0.050172 second(s), 9 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表