main.c

来自「3510 TFT彩屏的测试程序」· C语言 代码 · 共 62 行

C
62
字号
//=======头文件============
#include <iom16v.h>
#include <macros.h>
#include "3510i.h"
#include "bit.h"
#include "tu.h"
#include "keyscan.h"
#include "buzzpr.h"
#include "chinese_12x12_pixel.h"
//=========================
extern 	uchar LCD_BGColor;
extern	uchar LCD_PenColor;
extern 	uchar fBuzzring;
extern	BuzzringCnt;
void MCU_Initial(void)
{
	CLI();
	PORTA = 0x00;
	DDRA  = 0xFF;
	PORTB = 0x00;
	DDRB  = 0xFF;
	PORTC = 0x00; 
	DDRC  = 0xFF;
	PORTD = 0x00;
	DDRD  = 0xFF;
	
	TCCR0 = 0x00; //stop
 	TCNT0 = 0x83; //set count
 	OCR0  = 0x7D;  //set compare
 	TCCR0 = 0x02; //start timer
 	
 	MCUCR = 0x00;
 	GICR  = 0x00;
 	TIMSK = 0x01; //timer interrupt sources
 	SEI(); //re-enable interrupts
}
#pragma interrupt_handler timer0_ovf_isr:10
void timer0_ovf_isr(void)
{
 	TCNT0 = 0x83; //reload counter value
 	if(get_bit(fBuzzring,fbuzzring))
		xor_bit(PORTA,0);
	else
		clr_bit(PORTA,0);
}
void main(void)
{
	MCU_Initial();
	LCD_Initialize();
	LCD_BGColor = 0xff;//white color
	LCD_ClearScreen();
	LCD_PenColor=0b00000000;//black color
	LCD_WriteChineseString(font12x12,17,0,0);
	while(1)
	{
		Key_Scan();
		Key_Pr();
		Buzz_Pr();
		delay_nms(4);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?