您的位置 首页 IOT

AVR数码管扫描

includeavrioh>defineucharunsignedchardefineuintunsignedintuchardisplay[]={0x3f,0x06,0x5b,0x4f,0x6

#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)

{
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++);
}
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/iot/260641.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部