打印
[Atmel]

用AtmelStudio6.2跑mega16例程(18):点阵显示

[复制链接]
729|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
今天这个很好理解,大家自己就可看明白:

Proteus截图:




Atmel Studio 6.2程序:
/*
* GccApplication25.c
*
* Created: 2014-9-19 22:55:40
*  Author: Administrator
*/


#include <avr/io.h>
#define uchar unsigned char
#define uint unsigned int
unsigned char tab1[]={0x00,0x36,0x36,0x36,0x49};
unsigned char tab2[]={0x01,0x02,0x04,0x08,0x10};
void delay(uint n)
{
        uint i;
        for(i=0;i<n;i++);
}
int main(void)
{
        uchar j,t=0;
        DDRC=0xFF;
        PORTC=0xFF;
        DDRD=0xFF;
        PORTD=0xFF;
        while(1)
        {
                for(j=0;j<6;j++)
                {
                        PORTD=tab2[t];
                        PORTC=tab1[j];
                        delay(555);
                        t++;
                        if(t==6)
                        {
                                t=0;
                                PORTD=0x00;
                        }
                }
        }
}


相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2398

主题

6949

帖子

66

粉丝