📄 init_8515.c.bak
字号:
//ICC-AVR application builder : 2006-12-8 14:54:31
// Target : M8515
// Crystal: 7.3728Mhz
#include "config.h"
void port_init(void)
{
PORTA = 0x00;
DDRA = 0xE7;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00;
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
PORTE = 0x00;
DDRE = 0x00;
}
//TIMER1 initialize - prescale:1024
// WGM: 0) Normal, TOP=0xFFFF
// desired value: 2Sec
// actual value: 2.000Sec (0.0%)
void timer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0xC7; //setup
TCNT1L = 0xC1;
OCR1AH = 0x38;
OCR1AL = 0x3F;
OCR1BH = 0x38;
OCR1BL = 0x3F;
TCCR1A = 0x00;
//TCCR1B = 0x05; //start Timer
}
//UART0 initialize
// desired baud rate: 19200
// actual: baud rate:19200 (0.0%)
void uart0_init(void)
{
UCSRB = 0x00; //disable while setting baud rate
UCSRA = 0x00;
UCSRC = BIT(URSEL) | 0x36;
UBRRL = 0x17; //set baud rate lo
UBRRH = 0x00; //set baud rate hi
UCSRB = 0xD8;
}
//Comparator initialize
// trigger on: Rising output edge
void comparator_init(void)
{
ACSR = ACSR & 0xF7; //ensure interrupt is off before changing
ACSR = 0x0B;
}
//Watchdog initialize
// prescale: 2048K
void watchdog_init(void)
{
WDR(); //this prevents a timout on enabling
WDTCR = 0x18;
WDTCR = 0x0F; //WATCHDOG ENABLED - dont forget WDR
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -