Hi All,
I am facing issue in toggling led for 1 second using timer0,
led is connected to RB7 of PIC18f.
Though i can insert delay_ms(1000); and toggle led i wish to do it using timer and interrupt.
Here is my code :
#code
Timer code for PIC18f to toggle led for 1 second
I am facing issue in toggling led for 1 second using timer0,
led is connected to RB7 of PIC18f.
Though i can insert delay_ms(1000); and toggle led i wish to do it using timer and interrupt.
Here is my code :
#code
Code (Text):
- void main()
- {
- ADCON1 = 0x0F; // Disable Analog functions
- ANSELA=0;
- ANSELB=0;
- TRISB = 0x00;
- PORTA = 0x00;
- T0PS2_bit = 1; // 256 prescalar
- T0PS1_bit = 1;
- T0PS0_bit = 1;
- PSA_bit = 0; // source from FCPU 5MHz
- T0CS_bit = 1;...