Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Firing TRIAC using 89C52 and Infra RED Remote.

Status
Not open for further replies.

pradipdabhi

Newbie level 2
Joined
Feb 2, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
I have Made light dimmer with 89C52 using RC5 Infra red remote VOL+ and VOL- key.

RC5 IR interrupt is External Int. 0
timer0 interrupt for RC5 command processing.
Zero Crossing interrupt is External Int 1
Timer1 interrupt for trigger TRIAC

I am firing TRIAC with PIN 2_7.

My program works OK, till the timer1 interrupt for triggering TRIAC not occour.

My routine is as below

the SPEED variable is int and Filled through RC5 decoded command.

My PROBLEM is in TRIGGER routine which is Timer routine

This is not full program but i put some part of it here.


//=========================================================

#define IE0_VECTOR 0 /* 0x03 External interrupt 0 */
#define TF0_VECTOR 1 /* 0x0B Timer 0 */
#define IE1_VECTOR 2 /* 0x13 External interrupt 1 */
#define TF1_VECTOR 3 /* 0x1B Timer 1 */
#define SIO_VECTOR 4 /* 0x23 Serial port */


void ZeroCross(void) interrupt IE1_VECTOR using 1
{

if (SPEED==8)
{
TR1=0;
P2_7=0;
}
else if (SPEED==7)
{
TL1=0xFF;
TH1=0xFA;
ET1=1;
TR1=1;

}
else if (SPEED==6)
{
TL1=0xFF;
TH1=0xF9;
ET1=1;
TR1=1;

}
else if (SPEED==5)
{
TL1=0xFF;
TH1=0xF7;
ET1=1;
TR1=1;

}
else if (SPEED==4)
{
TL1=0xFF;
TH1=0xF6;
ET1=1;
TR1=1;

}
else if (SPEED==3)
{
TL1=0xFF;
TH1=0xF4;
ET1=1;
TR1=1;

}
else if (SPEED==2)
{
TL1=0xFF;
TH1=0xF0;
ET1=1;
TR1=1;

}
else if ((SPEED & 0x01)==0x01)
{
TL1=0x11;
TH1=0xF0;
ET1=1;
TR1=1;
}
else if (SPEED==0)
{
P2_7=1;
TR1=0;
}

}


void TRIGGER(void) interrupt TF1_VECTOR //Timer1 Ruotine For Trigger TRIAC
{

ET1=0;
TR1=0;
P2_7=1;
int t;
for(t=0;t<200;t++); // Problem is HERE while i m writing this sentence FOR LOOP. my program goes freeze. My RC5 Extrn. interrupt 0 for receiving IR is not workig after writing this line. and this sentence is necessary to FIRE TRIAC.
P2_7=0;

}



void main()
{
TMOD = 0x11;

EX0=1; // Extranal 0 interrupt for RC5 IR Receiving
IT0=1;
IE0=0;

IT1=1; // Extranal 1 interrupt for zero crossing
EX1=1;

EA=1; // Enable All Int.

while (1)
{
if ((command & 0x11) >= 0x11)
{
if (SPEED>0)
{
SPEED=SPEED-1;
}

delay_ms(500);
}

else if ((command & 0x10) >= 0x10)
{
if (SPEED>0)
{
SPEED=SPEED+1;
}

delay_ms(500);
}
}

}

//=========================================================

Please Help ME
 
Last edited:

Hey this problem solved by myself... After Trial and error i changed for loop delay and it worked!! Now my code looks like

void TRIGGER(void) interrupt TF1_VECTOR //Timer1 Ruotine For Trigger TRIAC
{

ET1=0;
TR1=0;
P2_7=1;
int t;
for(t=0;t<10;t++);
P2_7=0;

}

Hey I got it myself.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top