本帖最后由 zini1900 于 2013-12-10 20:06 编辑
电压表上的数码管,可显示个十百三位,我只看出PA的2,3,4位是位选。
const uchar table_PB[]={0XCF,0XFF,0XDF,0XDF,0XEF,0XCF,0XCF,0XDF,0XCF,0XCF,0xFF,0XFF,0xef,0xef,0XCF,0XEF};
const uchar table_PC[]={0x57,0XD7,0X67,0X47,0XC7,0X4F,0X4F,0XD7,0X47,0X47,0x6F,0XEF,0x7f,0X57,0X07,0XC7};
const uchar table_PD[]={0XFD,0X02,0XFD,0X02,0X02,0X02,0XFD,0X02,0XFD,0X02,0xFD,0x02,0xfd,0XFD,0XFD,0XFD};
void display_b(float v,uchar bai)
{
PB_ODR=table_PB[bai];
PC_ODR=table_PC[bai];
if(bai==0||bai==2||bai==6||bai==8)
PD_ODR&=table_PD[bai];
else
PD_ODR|=table_PD[bai];
PA_ODR=0X02;
delay(4);
PA_ODR&=0XFD;//关闭百位数码管电源
PB_ODR=0xff;
PC_ODR=0xff;
PD_ODR|=0x02;
} |
|