Discussion in "Project Doubts" started by    bagusdj    Jan 23, 2013.
Thu Feb 14 2013, 02:21 am
#21
void external0_isr(void) interrupt 0
{
triac=1;
for(i=0;i<500;i++) // delay 4ms.
delay_triac();
triac=0;

}

Your delay_triac() call does not create a 10uS delay, and this routine gives a delay of over 14 mS !

There are many possible problems with your setup, so you need to do some basic tests.

Disconnect the high voltage side and monitor the output pin with an oscilloscope.

Use the same code, but use counts of 32,64, 96 etc

void external0_isr(void) interrupt 0
{
triac=1;
for(i=0;i<32;i++) // delay 4ms.  //32,64, 96  1 mS increments
delay_triac();
triac=0;
}


Confirm that you get on times of 1,2,3 etc mS at 10mS intervals.
Tell us the result.
Thu Feb 14 2013, 11:28 am
#22



Disconnect the high voltage side and monitor the output pin with an oscilloscope.

ExperimenterUK




output pin of what? you would like me to observe output of moc3021 or observe the load input&output?
fyi, my crystal frequency is 11.0592MHz

-----

updated: i recently check my zero cross and its asymmetrical. in the early of the thread i posted my zc output and it shows symmetrical shape each 0. but recently i dont get that shape anymore.

result of zc scale of 5ms and 1Volt per div:


different with the previously i posted in this thread (page 1)

before, i used breadboard and then i use pcb. based on the same layout and same components. i double checked the connection and layout, and i dont see nothing wrong at least compared to my previous breadboard circuit. i use 4N26 for the zcd ic. what factor might effect my zero cross?

my main components are at89s52,moc3021,4n26,lcd 16x2, and adc0809


--------------------------------------------------------------------------------------------------------------

update: current image on scope occurs when interrupt cable from zc output connected to pin 3.2 (EX0). if i disconnected it, and measures the zc output, the zc pulse is symmetrical. if i connect to ex0, and measures, it crippled. i use black housed cable to connect them.

initially in program i give hi logic to pin 3.2. is necessary to give pin 3.2 hi if i need to use ex0 function?


[ Edited Thu Feb 14 2013, 06:45 pm ]
Thu Feb 14 2013, 04:35 pm
#23
@ bagusdj
can you post your zero cross circuit
Thu Feb 14 2013, 06:04 pm
#24


@ bagusdj
can you post your zero cross circuit

majoka





zcd goes to 3^2 (EX0). i realize when using 4N26, if i modify the R1 value, i can get different value of ZC square wave and its time required to form a square wave. i cannot show what osciloscope shown because oscilloscopes in my lab are uncalibrated.

if i use R1=10k, ZC pulse will takes more time to forming. but i got 3Vdc.

if i use R1=820, ZC pulse will takes less time to forming. but i got 0.8Vdc.

the more time taken to form a pulse means the less time for 0 to 0 interval. by theory its 10ms.

what is the minimal voltage that could trigger external interrupt of 89s52? datasheet just provide info about operating voltage which is 4-5.5Vdc

--------------------------------------------------------------------------------------------------------------

update: current image on scope occurs when interrupt cable from zc output connected to pin 3.2 (EX0). if i disconnected it, and measures the zc output, the zc pulse is symmetrical. if i connect to ex0, and measures, it crippled. i use black housed cable to connect them.

initially in program i give hi logic to pin 3.2. is necessary to give pin 3.2 hi if i need to use ex0 function?


[ Edited Thu Feb 14 2013, 06:46 pm ]
Fri Feb 15 2013, 12:06 am
#25




Disconnect the high voltage side and monitor the output pin with an oscilloscope.

ExperimenterUK


output pin of what? you would like me to observe output of moc3021 or observe the load input&output?

bagusdj



sbit triac=P3^0;
Port 3 bit 0...
AT89c52 pin 10

Confirm that you get high (5volts) times of 1,2,3 etc mS at 10mS intervals.
Does the high pulse start when the Zero crossing detector goes high or low ?
A sketch would be nice.

Tell us the result.


[ Edited Fri Feb 15 2013, 12:14 am ]
Sat Feb 16 2013, 12:01 am
#26





Disconnect the high voltage side and monitor the output pin with an oscilloscope.

ExperimenterUK


output pin of what? you would like me to observe output of moc3021 or observe the load input&output?

bagusdj



sbit triac=P3^0;
Port 3 bit 0...
AT89c52 pin 10

Confirm that you get high (5volts) times of 1,2,3 etc mS at 10mS intervals.
Does the high pulse start when the Zero crossing detector goes high or low ?
A sketch would be nice.

Tell us the result.

ExperimenterUK




this is the output of p3.0. when i use 32. measured at 1ms/div, 1v/div. note that my scope not properly calibrated. using multimeter, i got value 1.3Vdc


if compared with zc, less likely like this


for 64 and 96, the distance between pulse and zc is same.no significant change.

i use 11.0592 crystal,and my zc amplitude is about 1-2 Vdc.

here is the code that i used
#include<reg52.h>

 sbit triac=P3^0;
 void initint0(void);
 sbit intr0=P3^2;
unsigned int i,a;



void delay_triac()  // Function to provide time delay in 10 usec.
{
				// Mode1 of Timer1
	TH1= 0xFE;  				// 10 microsecond delay
	TL1 = 0xF6;
	TR1 = 1;   				// Start Timer
	while(TF1 == 0); 			// Using polling method
	TR1 = 0; 				// Stop Timer
	TF1 = 0;
}

void initint0(void)
 {
 IT0=1;
 EX0=1;
 EA=1;
 }



void external0_isr(void) interrupt 0

{

triac=1;
for(i=0;i<96;i++)
delay_triac();
triac=0;

}
 
 void main(void)
 {initint0();
  intr0=1;
  triac=1;
  TMOD = 0x10;
  while(1)
  {}
  }

Sun Feb 24 2013, 07:56 pm
#27
Your zero crossing signal is not proper. It should be periodic.
Sun Feb 24 2013, 08:02 pm
#28


Your zero crossing signal is not proper. It should be periodic.

Ajay Bhargav



i got zero cross like in the page one now. is it not periodic?
Sun Feb 24 2013, 09:12 pm
#29
With periodic I meant, you must see pulse at equal interval not like random as in the picture. And frequency should be either 50 or 60Hz.
Sat Mar 09 2013, 07:54 pm
#30
void external0_isr(void) interrupt 0 //interrupt routine
{
TR1=0;
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
		    {}
		
}


i try to create delay using timer. i used to use delay(5), delay(4), and delay(3). the measurement shows the voltage delivered is correct. but the lcd that displays adc value is messed up. i try to use timer instead of delay();

is this delay is right? i use tmod=0x10. my xtal is 11.0592MHz


[ Edited Mon Mar 11 2013, 10:22 am ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

PedroDug
Sun May 19 2024, 05:39 pm
JewelAmuck
Sun May 19 2024, 03:06 pm
Minniemus
Sun May 19 2024, 07:39 am
Andyhet
Sat May 18 2024, 07:28 am
BrettTibre
Fri May 17 2024, 06:14 pm
Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am
Patricknoind
Fri May 17 2024, 09:53 am