Sir this is my program but not working pls tell me the reason Unsigned long=i; void interrupt timer() { if(INTCONbits. TMR0IF==1) {i++; TMR0=236; INTCONbits. TMR0IF=0; }} void main() { TRISB=0; INTCONbits. GIE=1; INTCONbits. PEIE=1; INTCONbits. TMR0IE=1; OPTION_REG=0x27; TMR0=236; while(1) { if(i==1000) {PORTBbits.RB1=0; } if(i=2000) {PORTBbits.RB1=1; i=0;}} return;}
The calculation of the time delay is just great. Thank you!!
super bro Explanation.
😊
Best lecture.
Lekin baaki comments kaha hai
😊
Thank you, it is very clear but how is it different, using the timer and using __delay_ms(300);
Ya delay_ms also uses timer 0 in polling method but interrupt method produces more accurate time delay’s
@@SMtrainingacademy okay thank you
@@nyashadzashechikarakara5330 😊
Bro u r Pro
Thanks Rahul
Thank you, but.
why is machine cycle equal to 4/20MHz ?
where is 4 from ?
Sir this is my program but not working pls tell me the reason
Unsigned long=i;
void interrupt timer()
{
if(INTCONbits. TMR0IF==1)
{i++;
TMR0=236;
INTCONbits. TMR0IF=0;
}}
void main()
{
TRISB=0;
INTCONbits. GIE=1;
INTCONbits. PEIE=1;
INTCONbits. TMR0IE=1;
OPTION_REG=0x27;
TMR0=236;
while(1)
{
if(i==1000)
{PORTBbits.RB1=0;
}
if(i=2000)
{PORTBbits.RB1=1;
i=0;}}
return;}
Can you tell the error you got..?
Or send the program to
smtrainingacademy@gmail.com
I will rectify and send you back
@@SMtrainingacademy the problem I faced is led not toggled at RB1 pin while all the pins in Port B has been active high
Finally I got the answer I wrongly mentioned option register value 0x27 instead of 0x87 thank u sir
Ok