Skip to main content

Triac based four step touch dimmer MAIN CODING KEIL EMBEDDED C

#include <REGX51.H>
#include "lcd.c"

#define MAX_DELAY() delay(65000)

sbit one=P1^0;
sbit two=P1^1;
sbit three=P1^2;
sbit four=P1^3;

sbit Rly1=P0^0;
sbit Rly2=P0^1;

void intro()
{
 lcd_init();lcd_clr();
 lcd_str("8051 based Lamp ",0x80);
 lcd_str("Dimmer-TouchPlat",0xc0);
 MAX_DELAY();MAX_DELAY();
 lcd_clr();
}

//void convert_to_Binary(unsigned char num)
//{
// unsigned char temp = 0, i;
// for(i=0;i<8;i++)
// {
// temp = num & 0x80;
// num = num << 1;
// lcd_data((temp == 0) ? '0' : '1');
// }

//}

 void main()
 {
unsigned int i = 0, j= 0, cntr = 0;
// unsigned char port_val;
Rly1 = Rly2 = 0;
intro();
   while(1)
   {
lcd_str("Touch any Button ",0x80);
// port_val = P1;
// lcd_str("P1:",0xc0);
// convert_to_Binary(port_val);
// delay(65000);
// while(port_val == P1);



while((one == 1) && (two == 1) && (three == 1) && (four == 1))
delay(10000);
if(one == 0)
{
cntr = 65000;
while((one == 0) && (--cntr));
if(cntr <= 0)
{
lcd_str("1 -> Lamp On    ",0xc0);
Rly1 = 1; Rly2 = 0;
while(one == 0);
}
}
else if(two == 0)
{
cntr = 65000;
while((--cntr) && (two == 0));
if(cntr <= 0)
{
lcd_str("2 -> Lamp Dimm  ",0xc0);
Rly1 = 1; Rly2 = 1;
while(two == 0);
}
}
else if(three == 0)
{
cntr = 65000;
while((--cntr) && (three == 0));
if(cntr <= 0)
{
lcd_str("3 -> Lamp Off  ",0xc0);
Rly1 = 0; Rly2 = 0;
while(three == 0);
}
}

   }
 }

Comments

Popular posts from this blog

Jio

Reliance Jio planning its own  cryptocurrency called JioCoin  elder son Akash Ambani leading the JioCoin project, Reliance Jio plans to build a 50-member team of young professionals to work on blockchain technology, which can also be used to develop applications such as smart contracts and supply chain management logistics

PUNCHING MACHINE

ACCIDENT AVOIDING SYSTEM FOR PUNCHING MACHINE SYNOPSIS The aim of our project is to take a system-wide approach to preventing the machine accident. The system includes not just the machine and the operator; but rather, it includes everything from the initial design of the machine to the training of everyone that is responsible for any aspect of it, to the documentation of all changes, to regular safety audits and a finally a corporate culture of safety-first. Design is the part of a machine's life where the greatest impact can be made in relation to avoiding accidents. The designer should ensure that the machine is safe to set up and operate, safe to install, safe to maintain, safe to repair, and safe to decommission. Although safe operation is usually at the forefront of a designer's mind, safe maintenance and repair should also be a high priority. Around 50% of fatal accidents involving industrial equipment are associated with maintenance activities, and design...