📄 1602shizhong.c
字号:
/*----------------------------------------------------
主函数
编译器:GCC-AVR 日期: 2008-11-30 19:17:57
目标芯片 : M16
时钟: 8.0000Mhz
作者:Amas (参考archeng504)
---------------------------------------------------*/
volatile char j=0;
volatile char data[7]={59,59,23,29,2,8,0}; //秒、分、时、日、月、年 、星期选择
#define F_CPU 10000
#include "LCD.h"
#include"avr/io.h"
#include"LCD_init.h"
#include"avr/interrupt.h"
#include"avr/signal.h"
#include"time.h"
SIGNAL(SIG_OVERFLOW1) //溢出中断
{
TCNT1H=0x3c; // 重装载
TCNT1L=0xb0;
j++;
}
void initialize_timer(void) //设置中断类型,并开中断
{
TCNT1H=0x3c;
TCNT1L=0xb0;
// TCCR1A=0x00;
TCCR1B=0X01;
TIMSK=0X04;
sei();
}
/*void init_devices(void)
{
CLI(); //disable all interrupts
LCD_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
}========*/
int main(void)
{
// init_devices();
initialize_timer();
LCD_init();
for(;;)
{
LCD_time(data[2],data[1],data[0],data[3],data[4],data[5],data[6]);
time_change();
set_time();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -