Reposted with a [PIC] tag for more visibility. BAJ On Sun, Jan 20, 2013 at 07:45:15AM -0800, mircea2012 wrote: Hi all. I am new on this site and I have some questions about Pic microcontrollers. First I am a beginner in Pic microcontroller. I bought a development board from Matrix Multimedia, HP488, but I dont know why I fail with a smalle program. The program must flash a led with a delay (4 sec) using TMR0. So, from my calculations, using formula :=20 Freq. out =3D Freq. osc / [prescaler * (256 - TMR0) * count] The prescaler is 1 : 256; TMR0 is 0, anf the frequency oscilator is 4Mhz (osccon =3D 0b01100000) An instruction is executed in 4 clock cycles. So the frequency clock is 4Mh= z / 4 =3D 1Mhz. count =3D 61. I use sourceBoost IDE, and the compiler is BoostC. Look my code :=20 #include=20 unsigned int counter =3D 0;=20 void Delay(void)=20 { =20 if(intcon & 2) // check if TMR0IF is set=20 { =20 clear_bit( intcon, 2 ); // if TMR0IF is set, clear this bit counter =3D counter + 1; // increments the counter =20 if(counter =3D=3D 61) =20 { counter =3D 0; portb =3D ~portb; // flash the Led 0 of Port B } } =20 } void main(void)=20 { =20 trisb =3D 0x00; // set all pins of Port B as out= put portb =3D 0x01; // RB0 is high=20 tmr0 =3D 0; // the value of TMR0 register is zero. cmcon =3D 0x07; // comparators is off. option_reg =3D 0b00000111; // prescaler is assigned to the WDT, prescaler 1:256 intcon =3D 0b10100000; // GIE - enable, TMR0IE - enable while(1) { }=20 } The program compiles fine, upload fine, but dont show me the led flashing. What I am doing wrong ? Are there any configuration settings that I am not aware of ? --=20 Byron A. Jeff Chair: Department of Computer Science and Information Technology College of Information and Mathematical Sciences Clayton State University http://faculty.clayton.edu/bjeff --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .