静态数码管学习


#include "reg52.h"

typedef unsigned int u16;
typedef unsigned char u8;

#define SMG P0 //使用宏定义数码管段码口

//共阴极段码显示数据
u8 smg_code[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

//主函数
void main()
{
        P2=0x00;
    SMG=smg_code[7];
    while(1)
        {}
}

 

posted @ 2024-09-21 11:36  陈书年  阅读(39)  评论(0)    收藏  举报