bagusdj
Member level 3
- Joined
- Nov 25, 2012
- Messages
- 67
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,766
hey guys, i tried to delay tyristor using timer. i used to use delay(5);. delay(4);, and delay(3); it works, but my LCD that shows adc value is not shows it well. so i want to use timer for delay. my tmod is 0x10. my xtal is 11.0592MHz
but the problem is it seems the tyristor not delayed (thus, my load always run full power. it not happens when use delay()
here is my code. is what am done is wrong for the delay?
please help me
but the problem is it seems the tyristor not delayed (thus, my load always run full power. it not happens when use delay()
here is my code. is what am done is wrong for the delay?
Code:
void external0_isr(void) interrupt 0 //interrupt routine
{
triac=1;
if((input_port>=10) && (input_port<20)) //1st condition 5ms delay
{
TL1 = 0x00; //Lower Byte
TH1 = 0xFE; //Upper Byte
TR1 = 1; //Run timer
while(TF1==0);
TF1=0;
triac=0;
}
else if((input_port>20) && (input_port<30)) //2nd condition 4ms delay
{
TL1 = 0x99; //Lower Byte
TH1 = 0xF1; //Upper Byte
TR1 = 1; //Run timer
while(TF0==0);
TF1=0;
triac=0;
}
else if((input_port>30) && (input_port<40)) //3rd condition 3ms delay
{
TL1 = 0x33; //Lower Byte
TH1 = 0xF5; //Upper Byte
TR1 = 1; //Run timer
while(TF0==0);
TF1=0;
triac=0;
}
else if(input_port>40) //4th condition; full power no delay
{
triac=0;
}
else
{}
TR1=0;
}