//seg.c
#include
#include
#include "delay.h"
#define SEGPORT P0
sbit bit_select = P2^0;
sbit seg_select = P2^1;
unsigned char segdata[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void main()
{
unsigned char i;
SEGPORT = 0;
bit_select = 1;
bit_select = 0;
for(i = 0; i < 16; i++)
{
SEGPORT = segdata[i];
seg_select = 1;
seg_select = 0;
delay_ms(255);
}
}
共阴数码管显示1到15
最新推荐文章于 2023-05-01 06:13:03 发布