这个是单片机C语言共阳极数码管的部分程序,怎样改为共阴极

#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; /* 按键值标记变量 */

要么将table[] 中的所有代码按位取反,如0x3f改为0xc0
或在在显示程序中将其取反,如原来的P0=table[a1];
改成P0=~table[a1];追问

取反之后将原仿真图中的共阳极引脚改为共阴极的是不是就可以实现

追答

能改软件就不改“硬件”
另外,位选也要取反,如原来是最后一位数码管亮的代码是0x01(0000 0001)改成0xFE(1111 1110)

温馨提示:答案为网友推荐,仅供参考