新聞中心

AVR數(shù)碼管掃描

作者: 時間:2016-11-24 來源:網(wǎng)絡(luò) 收藏
#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)

本文引用地址:http://m.butianyuan.cn/article/201611/321008.htm

{
uchar temp=0,tempb;
uint i;

DDRD &= ~(1<<7);
PORTD |= (1 << 7);//打開上啦電阻
DDRB = 0xff;//設(shè)置為輸出
DDRA = 0xf0;//設(shè)置為輸出
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++);
}
}
}



關(guān)鍵詞: AVR數(shù)碼管掃

評論


技術(shù)專區(qū)

關(guān)閉