ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
18 июля
4677
nm5 (15.01.2004 18:14, просмотров: 1785)
ЧТО Я ДЕЛАЮ НЕ ТАК ЧТО Я ДЕЛАЮ НЕ ТАК КОМПЕЛЮ icc AVR И ПОТОМ В Visual Micro Lab (VMLAB) СМОТРЮ ЧТО ПОЛУЧАЕТСЯ //ICC-AVR application builder : 14.01.04 19:57:13 // Target : M8 // Crystal: 4.0000Mhz #include #include #define MY_INPUT PD0 void port_init(void) { PORTB = 0x00; DDRB = 0xFF; PORTC = 0x7F; //m103 output only DDRC = 0x00; PORTD = 0xFF; DDRD = 0x00; } //TIMER2 initialisation - prescale:256 // WGM: PWM Fast // desired value: 120Hz // actual value: 61,035Hz (96,6%) void timer2_init(void) { TCCR2 = 0x00; //stop ASSR = 0x00; //set async mode TCNT2 = 0x01; //setup OCR2 = 0xAF; TCCR2 = 0x7E; //start } #pragma interrupt_handler timer2_comp_isr:4 void timer2_comp_isr(void) { TCNT2=OCR2; } //call this routine to initialise all peripherals void init_devices(void) { //stop errant interrupts until set up CLI(); //disable all interrupts port_init(); timer2_init(); MCUCR = 0x00; GICR = 0x00; TIMSK = 0x80; //timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialised } // void main(void) { init_devices(); //insert your functional code here... if (PORTD & PD0) // bit - //if(PIND&(1<