ASM 板


LINE

看板 ASM  RSS
小弟知道网路上跟书上有很多,我自己试写了一个 用 keil c 写的 keypad 程式,但是七段就是不会亮, 请大大指点一下我错误的观念,我不知错再哪里? 硬体架构: OUTPUT 接收 89S51 P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 采用低态驱动 P2 接 7段显示器 程式: #include <AT89X51.H> char keypad(void); code char table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88, 0x83,0xc6,0xa1,0x86,0x8e,0xff}; main() { char n; while(1) { n=table[keypad()]; P2=~n; } } char keypad(void) { char key=16; if (P0==0x77) { key=0; return key; } else if (P0==0x7b) { key=1; return key; } else if (P0==0x7c) { key=2; return key; } else if (P0==0x7e) { key=3; return key; } else if (P0==0xb7) { key=4; return key; } else if (P0==0xbb) { key=5; return key; } else if (P0==0xbc) { key=6; return key; } else if (P0==0xbe) { key=7; return key; } else if (P0==0xc7) { key=8; return key; } else if (P0==0xcb) { key=9; return key; } else if (P0==0xce) { key=10; return key; } else if (P0==0xc7) { key=11; return key; } else if (P0==0xe7) { key=12; return key; } else if (P0==0xeb) { key=13; return key; } else if (P0==0xec) { key=14; return key; } else if (P0==0xee) { key=15; return key; } } --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.72.21.230
1F:推 ruemann:因为你的keypad程序是不会work的…… 02/09 19:02
2F:→ ruemann:简单讲就是P0可能恒为1(有pull-high)或恒为0(没有pull-h 02/09 19:03
3F:→ ya88552200:会是P0没接提昇电阻吗? 02/10 00:06







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Gossiping站内搜寻

TOP