mega16控制74hc595驱动数码管源码与电路原理图纸。
// 定义数码管显示的控制IO
// 通过2片74HC595分别控制数码管的地址和数据
// 控制线PORTD4~PORTD7
// John 07.9.20
//
#define digi_led_port PORTD
#define digi_led_addr 7 //数码管地址选择
#define digi_led_data 6 //数码管数据输入
#define digi_led_rclk 5 //移位脉冲
#define digi_led_sclk 4 //锁存脉冲
//
//定义数码管 "8"字的位段//
#define sa 0xfd // ___a___
#define sb 0xf7 // f| |b
#define sc 0xbf // | |
#define sd 0xdf // g
#define se 0xef // e| |c
#define sf 0xfb // | |
#define sg 0xfe // d
#define sdp 0x7f
unsigned char DigiLEDData; //数码管要显示的数据
unsigned char DigiLEDAddr; //要选择数码管的地址
unsigned char DigiLEDPosi; //要显示数码管的位置
unsigned char dispbuff[6]; //6位数码管的显示缓存
//
// 6位数码管的选通地址,每个时刻只能有一位数码管被选择
// John 2007.12.1
//
无需注册
const unsigned char LEDAddr[7] PROGMEM =
{
0x7f,0xbf,0xdf,0xfb,0xf7,0xef,0xfd
};
//
// 数码管字码表 ASCII
// John 07.12.1
//
const unsigned char DigiLEDSeg[138] PROGMEM =
专业软件下载
,大小:227 KB