Discussion in "Project Doubts" started by    bagusdj    Jan 9, 2013.
Wed Jan 09 2013, 12:12 pm
#1
hey guys. i am planning to create project using principal of phase firing angle.

my reference is this site http://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(attached)
using the same 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
Thu Jan 10 2013, 11:07 am
#2
anybody?
Fri Jan 11 2013, 05:09 am
#3
This is a cut down version of your circuit that works.
It may give a starting point to fault find the full circuit.

Remember to use SW1 to turn the power on.

How much of your PC's cpu power does it take to simulate your full circuit ?



[ Edited Fri Jan 11 2013, 05:13 am ]
Fri Jan 11 2013, 06:25 am
#4
how do i know the power that i used for running the circuit? is it the power that i used to plug to my computer?
Fri Jan 11 2013, 06:39 am
#5
In Proteus, click the "Run" button.
Move the mouse cursor to the area just below the Run/Stop/Pause buttons
The text will display something like "CPU load 34%"
If too high ..say 99% the simulation will be slow and not reliable.
Fri Jan 11 2013, 09:34 am
#6
the load using your project is 23% and using mine is 80-90%. why is that?
Fri Jan 11 2013, 08:44 pm
#7
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

i change the mcu in proteus using 8535, and its fine. the zero cross is detected. when i use 89s52, the zcd not pulsing each 10ms.

is it just in simulation? because there is no oscilloscope around me right now
Sat Jan 12 2013, 03:45 pm
#8
when using clock generator instead of moc npn, the oscilloscope in proteus can show that zcd pulsing.

if i use moc npn, the oscilloscope cant show any. if it just output of moc npn (without connecting it to interrupt pin), it can shows.
Sun Jan 13 2013, 06:26 pm
#9
@ bagusdj
do not make a full circuit in the Proteus
some things in Proteus will not work as we think
simply check a logic in Proteus is it ok or not
the pin that is controlling the fire angle
check on that is wave is present or not
wave will be like a pwm signal
Sun Jan 13 2013, 06:47 pm
#10


@ bagusdj
do not make a full circuit in the Proteus
some things in Proteus will not work as we think
simply check a logic in Proteus is it ok or not
the pin that is controlling the fire angle
check on that is wave is present or not
wave will be like a pwm signal

majoka



i tried to simulate only the moc npn and the 8051. no signal detected (the colored box indicated hi or low doesnt blink). when i replace it with 8535 in the same schematic, it pulsing. here is the example (attached)

if you dont connect it o int0, it reads pulse. if you connect it, it flat.

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