PIC C code and Comparator Hysteresis
Thu Aug 23 2007, 03:29 pm
how does the following cunction give 1 second delay?
void sec1()//can be fine tuned by changing the for loop values
{
bit_8 i,j;
TMOD=0x11;
for(i=0;i<230;i++)
_nop_();
for(i=0;i<7;i++)
{
TH1=0;
TH0=1;
TL1=0;
TL0=0;
TR1=1;
for(j=0;j<119;j++)
_nop_();
while(TF1!=1)
{
for(j=0;j<255;j++);
_nop_();
}
TF1=0;
TR0=1;
TR1=0;
while(TF0!=1)
{
for(j=0;j<120;j++)
_nop_();
}
TF0=0;
TR0=0;
}
}
void sec1()//can be fine tuned by changing the for loop values
{
bit_8 i,j;
TMOD=0x11;
for(i=0;i<230;i++)
_nop_();
for(i=0;i<7;i++)
{
TH1=0;
TH0=1;
TL1=0;
TL0=0;
TR1=1;
for(j=0;j<119;j++)
_nop_();
while(TF1!=1)
{
for(j=0;j<255;j++);
_nop_();
}
TF1=0;
TR0=1;
TR1=0;
while(TF0!=1)
{
for(j=0;j<120;j++)
_nop_();
}
TF0=0;
TR0=0;
}
}
Thu Aug 23 2007, 03:40 pm
well i was noob at that time.. when i wrote that function.. try writing a better 1 sec delay yourself take care of the call and jumps etc.
try making 1 sec routine with the help of simple for loops.. i think thats much better..
try making 1 sec routine with the help of simple for loops.. i think thats much better..
Thu Sep 06 2007, 11:48 am
well ajay, i would like to request u plz start PIC projects and coding PIC controllers so that we can get skills to program it easily.
Thu Sep 06 2007, 01:30 pm
well Luqman, i really want to start by i don't have PIC controller with me.. and i think there is not much difference in controllers..
PIC AVR 8051 everything is same.. there is no difference.. whatever you make in 8051/AVR you can do the same thing in PIC to.. the only difference is features and some registers thats all..
When i get a PIC IC with me... i will start another step by step tutorial for it... Thank you for your input...
PIC AVR 8051 everything is same.. there is no difference.. whatever you make in 8051/AVR you can do the same thing in PIC to.. the only difference is features and some registers thats all..
When i get a PIC IC with me... i will start another step by step tutorial for it... Thank you for your input...
Powered by e107 Forum System