📄 init.c
字号:
/********************************************************************************
* Inicializace procesoru *
********************************************************************************/
#include "Konst.c"
void Init_uPC(void)
{
// Input/Output Ports initialization
// Port A initialization
PORTA=0xff; // Pull-up
DDRA=0x00; // Vstupni piny OK
// Port B initialization
PORTB=0x03; // Pocatecni stav Log 1
DDRB=0xff; // Vystupy - OK
// Port C initialization
PORTC=0x00; // Tristate
DDRC=0x00; // Vstupy
// Port D initialization
PORTD=0x00; // Tristate
DDRD=0xff; // Vystupy - sedmosegmentovy displej
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 1000,000 kHz
// Mode: CTC top=OCR0
// OC0 output: Disconnected
TCCR0=0x0; // Citac zastaven, clear on compare, Toggle on compare - OC0 pin
TCNT0=0x00; // Pocatecni hodnota citace 0
OCR0=0x0; // Comparacni hodnota - 0x3Ah=58
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00; // Nepouzit
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00; // Nepouzit
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00; // Nepouzito
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00; // Interupt on compare
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80; // Nepouzit
SFIOR=0x00;
// Global enable interrupts
// #asm("sei") // Povoleni preruseni
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -