DESIGN OF VOLTAGE REGULATOR!!!!

by barkkathulla 2012-09-20 14:35:16

<font color=#AA0066>Design of Voltage Regulator</font>

#include<reg51.h>
#include "header.h"
#include "lcd.C"

sbit trigr3021 = P2^1; // TRIGGERING SCRs

void delay(int);
void init();

/* dc/ac motor declaration */
unsigned int tmin = 57800,tmax = 60500,timervalue1,timervalue2;
unsigned char dtime = 5,time = 5, triggerflag = 0, starto = 0,timerlow = 0x0,timerhigh = 0xe0;
/* dc/ac motor declaration */


void exinterrupt0(void) interrupt 0
{
// need to start timer0 interrupt
if(starto)
{
TL0 = timerlow; // 0;
TH0 = timerhigh; // 0xe0;
ET0 = 1;
TR0 = 1;
triggerflag = 1;
}
}

void inttimer0(void) interrupt 1
{

if(triggerflag)
{
TL0 = 0;
TH0 = 0xfe;
triggerflag = 0;
trigr3021 = 1; // start triggering scr
}
else
{
ET0 = 0;
TR0 = 0;
triggerflag = 1;
trigr3021 = 0; // stop signalling scr
}
}

void main()
{
init();
delay(10000);
delay(10000);
delay(10000);
delay(10000);
delay(10000);
P2 = 0;
delay(10000); /* startup delay.*/
lcdinit(); /* initialize on board LCD.*/
clrscr(10); /* it cleares both the screen */
printstr(" AC TO DC ",0,0); /* Print string into LCD Screen.*/
printstr(" DRIVER ",0,1); /* Print string into LCD Screen.*/

while(1)
{
timervalue1 = tmax; //tmin+500; // give value between tmin to tmax (57800 to 60500);
timervalue2 = timervalue1;
timerlow = timervalue1;
timerhigh = timervalue2 >> 8;
starto = 1;
}
}


void init()
{

P0 = 0xff;
P1 = 0x00;
P2 = 0x00;
IE = 0x81; // enable external interrupt alone
SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */
TMOD = 0x01; // no need
IE0 = 1;
IT0 = 1;
TCON = 0x01;
TMOD = TMOD | 0x21 ; /* Timer 1 in mode 2 */
}





void delay(int i)
{
while(i)
i--; //approx takes i*10 microsec
}

DESIGN OF PROCESS CONTROL TIMER IN MICRO CONTROLLER
#include <reg51.h>
sbit st1 = P0^0; // switch 1
sbit st2 = P0^1; // switch 2
sbit st3 = P0^2; // switch 3
sbit led1 = P2^0; // led 1
sbit led2 = P2^1; // led 2
sbit led3 = P2^2; // led 3
void delay(unsigned int del)
{
while(del) // (del * 1) Us delay
{
del--;
}
}
void main()
{
unsigned char i;
P2 = 0xff;
P1 = 0xff;
P0 = 0xff;
while(1)
{
while(st1 == 0) // time delay 1
{
for(i=0;i<10;i++)
{
delay(10000);
}
led1 = 1;
for(i=0;i<10;i++)
{
delay(10000);
}
led1 = 0;
}

led1 = 1;

while(st2 == 0) // time delay 2
{
for(i=0;i<20;i++)
{
delay(10000);
}
led2 = 1;
for(i=0;i<20;i++)
{
delay(10000);
}
led2 = 0;
}

led2 = 2;

while(st3 == 0) // time delay 3
{
for(i=0;i<30;i++)
{
delay(10000);
}
led3 = 1;
for(i=0;i<30;i++)
{
delay(10000);
}
led3 = 0;
}

led3 = 1;
}
}
679
like
0
dislike
0
mail
flag

You must LOGIN to add comments