⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initrialm128.h

📁 12864液晶不带字库的各种刷屏显示方式
💻 H
字号:
//ICC-AVR application builder : 2007-6-27 10:26:06
// Target : M8
// Crystal: 8.0000Mhz

/**************初始化m8函数***************/
#ifndef Initrial_M128_H
#define Initrial_M128_H

void Init_Devices(void);
void Port_Init(void);
void Init_Devices(void);
void Timer0_Init(void);

void Timer0_Init(void);

//void Timer1_Init(void);	
//void Timer1_Ovf_Isr(void);

//call this routine to initialize all peripherals
void Init_Devices(void)
{
	//stop errant interrupts until set up
	CLI(); //disable all interrupts
	Port_Init();
	//Timer0_Init();
	//Uart0_Init();
	//Uart1_Init();
	SEI(); //re-enable interrupts
	//all peripherals are now initialized
}

void Port_Init(void)
{
	PORTA = 0xff;
	DDRA  = 0xff;
	PORTB = 0xff;
	DDRB  = 0xff;
	PORTC = 0xff; //m103 output only
	DDRC  = 0xff;
	PORTD = 0xff;
	DDRD  = 0xff;
	PORTE = 0xff;
	DDRE  = 0xff;
	PORTF = 0xff;
	DDRF  = 0xff;
	PORTG = 0xff;
	DDRG  = 0xff;

	//BEEP_PORT &=~ BIT(BEEP);
}

//TIMER0 initialize - prescale:1024
// WGM: Normal
// desired value: 10mSec
// actual value:  9.984mSec (0.2%)
void Timer0_Init(void)
{
	TCCR0 = 0x00; //stop
	ASSR  = 0x00; //set async mode
	TCNT0 = 0xB2; //set count
	OCR0  = 0x4E;
	TCCR0 = 0x07; //start timer prescale:1024
	TIMSK |= BIT(TOIE0); //timer0 interrupt sources
}

#endif




⌨️ 快捷键说明

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