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

garbage monitoring using arduino code with gsm

#include <SoftwareSerial.h> #include <LiquidCrystal.h> //LiquidCrystal lcd(7, 6, 5, 4, 3, 2); LiquidCrystal lcd(13, 12, 11, 10, 9, 8); SoftwareSerial mySerial(0,1); #define trigPin 2 #define echoPin 3 #define PIR_sensor 4 #define m11 5 #define m12 6 void setup() {    lcd.begin(16, 2);    lcd.print("    Garbage    ");    Serial.println("garbage ");   lcd.setCursor(0,1);   lcd.print("   Open Close    ");   Serial.println(" open close");   delay(3000);   lcd.clear();   //lcd.print(" ");   delay(2000); mySerial.begin(9600); // Setting the baud rate of GSM Module Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);  pinMode(m11, OUTPUT);   pinMode(m12, OUTPUT);   } void loop() {  readPIR();  pingDist();  SendMessage(); } void pingDist ()   {     long duration, distance;...