#include <reg51.h>
#include <intrins.h>
#include <ctype.h> /* isdigit()函数 */
#include <stdlib.h> /* atoi()函数 */
#define uchar unsigned char
#define uint unsigned int
uchar operand1[9], operand2[9]; /* 操作数 */
uchar operator; /* 操作符 */
void delay(uint);
uchar keyscan();
void disp(void);
void buf(uint value);
uint compute(uint va1,uint va2,uchar optor);
uchar code table[] = {
0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,0x00}; /* 字符码表 */
uchar dbuf[8] = {10,10,10,10,10,10,10,10}; /* 显示缓存 */
/* 延时函数 */
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
/*******************************************
键盘扫描程序
将按键转化为字符并作为输出
'$','#'分别表示清零键和没有键按下
*******************************************/
uchar keyscan()
{
uchar skey; /* 按键值标记变量 */
取反之后将原仿真图中的共阳极引脚改为共阴极的是不是就可以实现
能改软件就不改“硬件”
另外,位选也要取反,如原来是最后一位数码管亮的代码是0x01(0000 0001)改成0xFE(1111 1110)