1、* 实验说明 : 8 位数码管显示 0F#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
2、、8、9、A、b、C、d、E、F 的显示码unsigned char DisplayData8;/用来存放要显示的 8位数的值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;/消隐