/*******************************************************
This program was created by the
CodeWizardAVR V3.12 Advanced
Automatic Program Generator
?Copyright 1998-2014 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 2024/6/6
Author :
Company :
Comments:
Chip type : ATmega16
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 256
*******************************************************/
#include
#asm
.equ __lcd_port=0x15
#endasm
// Alphanumeric LCD functions
#include
typedef unsigned char byte;
// Declare your global variables here
flash byte led_7[16]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,0x77,
0x7c,0x39,0x5e,0x79,0x71};
byte counter;
interrupt [EXT_INT0] void ext_int0_isr(void)
{
if(++counter>=16)counter=0;
}
interrupt [EXT_INT1] void ext_int1_isr(void)
{
if(counter)--counter;
else counter=15;
}
void main(void)
{
// Declare your local variables here
// Alphanumeric LCD initialization
// Connections are specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu:
// RS - PORTA Bit 0
// RD - PORTA Bit 1
// EN - PORTA Bit 2
// D4 - PORTA Bit 4
// D5 - PORTA Bit 5
// D6 - PORTA Bit 6
// D7 - PORTA Bit 7
// Characters/line: 8
PORTA=0xff;
DDRA=0XFF;
GICR|=0XC0;
MCUCR=0X0A;
GIFR=0XC0;
counter=0;
#asm("sei");
while (1)
{
// Place your code here
PORTA=led_7[counter];
}
}
仿真效果
文章评论(0条评论)
登录后参与讨论