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.

simulation using proteus

Status
Not open for further replies.

njakarish

Newbie level 2
Newbie level 2
Joined
Apr 3, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
am simulating a home automation system using 8051 and relays, i have a code and the circuit is working ok but am failing to send commands to switch the bulbs on, some one help me how to do it with help of compim
 

Are you having problems with hardware side or the software side? Uploading the Proteus file will be more usefull.
Cheers
 

#include<REG52.h>
unsigned char light;
int interpret;
/* The pins of the port 0 are connected to power line of various

home appliances through the control circuitry to control them by
on/o? the power supply. */

sbit light1=P0^0; // Pin connected to the control circuit of the Light 1.
sbit light2=P0^1;
sbit TV=P0^2; // Pin connected to control circuit of power supply of TV.

sbit PC = P0^3;
sbit oven = P0^4;
sbit washing = P0^5;
sbit coller = P0^6;
sbit CD = P0^7;

char packet[4];
char index;
void init(void);
void delay (int m);
void init()
{
TMOD=0X20;
TH1=0xFD; /* select baud rate 9600 */
SCON=0x50;


TR1=1; /* start timer */
}

void main (void)
{
int k=0;
char i;
init(); ES=1; EA=1;
for (i=0;i<4;i++){
packet=0;
}
index=0;
interpret=0;

while(1)
{
{
P0=light1;
delay(1000);
}

}}

void delay (int m)
{ int z;
z=m;
while ( m >0)
{ m--;}
}

void serialisr() interrupt 4

{
unsigned char y;
char i;
RI=0;
y=SBUF;
TI=0; SBUF=y; while (!TI);TI=0;
packet[index]=y;
index++;
if (y=='z') {interpret =1; index = 0;}
else interpret = 0;
if (interpret==1)
{
switch (packet[0])
{
case 'A':
light1=1; // switch on the bulb1
break;

case 'B':
light1=0; // switch off the bulb1
break;

case 'C':
light2=1; // switch on the bulb2
break;

case 'D':
light2=0; // switch off the bulb2// // switch on Washing machine
break;
case 'E':
TV=1; // switch on the TV
break;
case 'F':
TV=0; // switch off The TV
break;
case 'G':
PC=1; // switch on PC
break;
case 'H':
PC=0; // switch o? the PC
break;
case 'I':
oven=1; // switch on oven
break;
case 'J':
oven=0; // switch o? oven
break;
case 'K':
washing=1; // switch on the washing machine
break;
case 'L':

washing=0; // switch o? the washing machine
break;
case 'M':
coller=1; // switch on cooler
break;
case 'N':
coller=0; // switch o? the cooler
break;
case 'O':
CD=1; // switch on CD player
break;
case 'P':
CD=0; // switch o? CD player
break;
}

for (i=0;i<8;i++){
packet=0;
}
interpret=0;
}}

am using the above code to send commands to the circuit to switch on or off, and i have failed to send command. i need help how
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top