这是比较常见的问题,实际的解决办法就是对于数字做个库
对于在一个数字高低位在不同地址的,建议先以4bit为单位,就是把每个seg的数值放在变量的bit0~bit3,最后再拼接起来(IIC发送的时候拼接),
以下仅供参考,是我平时用的方法
const volatile uchar ledDispTable[]=
{
0xfa,0x0a,0xbc,0x9e,0x4e,0xd6,0xf6,0x8a,0xfe,0xde/*0 --9*/,
0xee/*10A*/,0x76/*11b*/,0xf0/*12C*/,0x3e/*13d*/,0xf4/*14E*/,
0xe4/*15F*/,0xde/*16g*/,0x6e/*17H*/,0x0a/*18I*/,0x1a/*19J*/,
0x00/*20K*/,0x70/*21L*/,0x00/*22M*/,0x26/*23n*/,0xfa/*24o*/,
0xec/*25p*/,0xce/*26q*/,0x24/*27r*/,0xd6/*28S*/,0x8a/*29t*/,
0xec/*30U*/,0x00/*31v*/,0x00/*32W*/,0x00/*33X*/,0x5e/*34Y*/,
0x00/*35Z*/,0x04/*36-*/,
};
void LoHourDisp(uchar temp)
{
uchar i;
i=ledDispTable[temp];
rLcdData[13]|=i&0x0e;
i=i>>4;
rLcdData[12]|=i&0x0f;
}
|