新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > AVR数码管扫描

AVR数码管扫描

作者: 时间:2016-11-24 来源:网络 收藏
#include <avr/io.h>

#define uchar unsigned char
#define uint unsigned int
uchar display[] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
uchar slice[] = { 0x70,0xb0,0xd0,0xe0};
int main(void)

本文引用地址:https://www.eepw.com.cn/article/201611/321008.htm

{
uchar temp=0,tempb;
uint i;

DDRD &= ~(1<<7);
PORTD |= (1 << 7);//打开上啦电阻
DDRB = 0xff;//设置为输出
DDRA = 0xf0;//设置为输出
tempb = PIND;

while(1)
{

for(temp=0;temp<4;temp++)
{
PORTA = slice[temp];
PORTB =display[temp];
for(tempb=0;tempb<200;tempb++)
for(i=0;i<2000;i++);
}
}
}



关键词: AVR数码管扫

评论


技术专区

关闭