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.

phase firing angle for fan using at89s52

Status
Not open for further replies.

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 am planning to create project using principal of phase firing angle.

my reference is this site https://www.8051projects.net/news-i188-single-phase-ac-motor-speed-controller-project-report.html. in the download page you will find the report,code,and schecmatic.

using that reference i model it into proteus: View attachment phasecontrol.rar
using the same code:
Code:
#include<reg52.h>

#define bargraph P2

sbit  led1 = P3^7;
sbit  led2 = P3^6;
sbit   s1  = P1^0;
sbit   s2  = P1^1;
sbit   s3  = P1^2;
sbit pulse = P0^0;
 
/*code unsigned char timer_l[10]={0x38,0x3c,0x69,0x81,0x99,0xb1,0xc9,0xe1,0x94,0x11};
code unsigned char timer_h[10]={0xfc,0xf6,0xf4,0xf0,0xec,0xe8,0xe4,0xe0,0xdf,0xd9};*/

code unsigned char timer_l[10]={0x38,0x3c,0x69,0x81,0x78,0xb1,0xc9,0xe1,0x94,0x11};
code unsigned char timer_h[10]={0xfc,0xf6,0xf4,0xf0,0xec,0xe8,0xe4,0xe0,0xdf,0xd9};

code unsigned char fonts[10]={0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00};
unsigned char speed;
 
bit on=0;

void delay_ms (unsigned int);


void decangle(void)                              //decrease delay by 1ms
{
if(speed>0)                                      
{ 
speed--;                                        // decrease delay
if(speed!=8)
bargraph=fonts[speed];
}                                                                       
}

void incangle(void)                             // increase delay by 1 ms
{
if(speed<9)
{
speed++;
bargraph=fonts[speed];
}
}

void tx (unsigned char x)
{
SBUF=x;
while(TI==0);
TI=0;
}
 
void int0(void) interrupt 0                     // external interrupt 0 subroutine
{
led1=~led1;                                         // led is on

if(on==1)
{
if(speed==0)
{
pulse=1;                                       // oFF the triace permenately
return; 
}

else if(speed==9)
{
pulse=0;                                       // on the triace permenately
return;                                  
}

else
{
pulse=1;
TL0 = timer_l[9-speed];                               
TH0 = timer_h[9-speed];
TR0 = 1;   
}
}
else
pulse=1;
}


void timer0 (void) interrupt 1
{
TR0=0;
pulse=0;
}

void int1(void) interrupt 2      // external interrupt 1 subroutine
{

if(s1==0)                        // for first key
on=~on;                          // increase counter
       
else if(s2==0)                  // for second key                           
incangle();                     // increase phase angle decrease power
       
else if(s3==0)                 // for third key
decangle();                    // decrease phase angle increase power

delay_ms(300);
} 

void uart(void)
{
SCON = 0x50;   
TH1	 = 0xF3;      
TL1	 = 0xF3;    
TR1  = 1;       
}

void init(void)
{
TMOD=0x21;                                   // initialize timer0 as 16 bit timer , timer1 as 16 bit counter
IT0=IT1=1;                                   // making edge trigger
bargraph=0xFF;                               // making all leds off                  
EX0=EX1=ET0=1; 								 // enable interupts of timer0 abd external interrupt 0 & 1
EA=1;
}

void delay_ms (unsigned int count)
{
unsigned int i;                         
    while(count) {
        i = 115;
                while(i>0) i--;
        count--;
}
}

void send(unsigned char *str) // sending a whole string to port
{
while(*str)
{
tx(*str++);
delay_ms(2);
}
}

void main(void)
{
unsigned char a;
init();
uart();
while(1)                                     // continuous loop 
{

if(on==0)
led2=1;
else
led2=0;

if(RI==1)
{
a=SBUF;
RI=0;
switch(a)
{
case 'A':
speed=0;
send("Motor is off\r\n");
bargraph=fonts[speed];
break;

case 'B':
speed=1;
send("Level 1\r\n");
bargraph=fonts[speed];
break;

case 'C':
speed=2;
send("Level 2\r\n");
bargraph=fonts[speed];
break;

case 'D':
speed=3;
send("Level 3\r\n");
bargraph=fonts[speed];
break;

case 'E':
speed=4;
send("Level 4\r\n");
bargraph=fonts[speed];
break;

case 'F':
speed=5;
send("Level 5\r\n");
bargraph=fonts[speed];
break;

case 'G':
speed=6;
send("Level 6\r\n");
bargraph=fonts[speed];
break;

case 'H':
speed=7;
send("Level 7\r\n");
bargraph=fonts[speed];
break;

case 'I':
speed=8;
send("Level 8\r\n");
bargraph=fonts[speed];
break;

case 'J':
speed=9;
send("Full \r\n");
bargraph=fonts[speed];
break;

default:
on=~on;
if(on==0)
send("Power is disabled\r\n");
else
send("Power is enabled\r\n");
break;
}
}
}                   
}

in the oscilloscope the form of wave doesn't change. what could be the cause?

when i connect the output of zcd to MCU, the probe 1 in oscilloscope read it as full dc (flat). if i dont connect it, the probe 1 read it as pulse each 10ms
 

anyone? *bump*

- - - Updated - - -

anyone? *bump*
 

here what you have to do is just connect your zcd to any of the intterrupt pin of your controller and check for int pin is detecting or not using togling one led
on intterupt sevice routine

and connect one resister to yor interrupt pin to gnd and connect zcd out to the same pin
 

hy .

i have created firing angle controlled soldering iron with lcd.
MCU = AT89S52;
View attachment 85406

hi there, thanks for providing the hex and the schematic. seems cool. can you show me the code if you are using C compiler? because i want to compare it and test it for my device :)

what is RN1 component? is it a bar graph?

and then, what p1.1 and p1.2 does with switch?
 

what happen about this, in simulation, when i connect the output of zcd to MCU, the probe 1 in oscilloscope read it as full dc (flat). if i dont connect it, the probe 1 in the optocoupler pin 5 read it as pulse each 10ms
 

if the zc is not one, the interrupt will not execute its routine. if in proteus i change my mcu, lets say 8535, the zc is 1. i dont if its just in the proteus or also in hardware. because im not around any oscilloscope right now :(
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top