《动态数码管不用译码器显示1页》由会员分享,可在线阅读,更多相关《动态数码管不用译码器显示1页(1页珍藏版)》请在金锄头文库上搜索。
1、动态数码管不用译码器显示#include#define GPIO_DIG P0/段选#define GPIO_PLACE P1/位选/-定义全局变量-/unsigned char code DIG_PLACE8 = 0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f;/位选控制 查表的方法控制unsigned char code DIG_CODE17 = 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71;/0、1、2、3、4、5、6、7、8、9、A、b、C、
2、d、E、F的显示码unsigned char DisplayData8;void DigDisplay(); /动态显示函数void main(void)unsigned char i;for(i=0; i8; i+)DisplayDatai = DIG_CODEi;while(1)DigDisplay();void DigDisplay()unsigned char i;unsigned int j;for(i=0; i8; i+)GPIO_PLACE = DIG_PLACEi; /发送位选GPIO_DIG = DisplayDatai; /发送段码j = 10; /扫描间隔时间设定while(j-);GPIO_DIG = 0x00;/消隐