Google

Tuesday, November 25, 2008

Industrial Temperature monitoring system





click on image for clear view





component list


C program

#include


sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit DQ=P2^5;
sbit output=P2^6;


void lcdcmd(unsigned char value);
void lcddata_number(unsigned char value);
void lcddata(unsigned char *value);
void lcddelay(unsigned int time);
bit reset();
void delay(int us);
bit readbit(void);
void writebit(bit dbit);
unsigned char readbyte(void);
void writebyte(unsigned char dout);
void readtemp();
unsigned char mydata1,mydata2,mydata3;

void main()
{
lcdcmd(0x38);
lcddelay(10);
lcdcmd(0x0e);
lcddelay(10);
lcdcmd(0x01);
lcddelay(10);
lcdcmd(0x06);
lcddelay(10);
lcddata("temperature");
while(1)
{
readtemp();
}
}
bit reset()
{
bit presense;
DQ=0;
delay(29);
DQ=1;
delay(3);
presense=DQ;
delay(25);
output=presense;
return(presense);
}
bit readbit(void)
{
unsigned char i=0;
DQ=0;
DQ=1;
for(i=0;i<3;i++);
return(DQ);
}
void writebit(bit Dbit)
{
unsigned char i=0;
DQ=0;
DQ=Dbit?1:0;
delay(5);
DQ=1;
}
unsigned char readbyte(void)
{
unsigned char i;
unsigned char din=0;
for(i=0;i<8;i++)
{
din=readbit()?0x01<delay(6);
}
//B=din;
return(din);
}
void writebyte(unsigned char dout)
{
unsigned char i;
for(i=0;i<8;i++)
{
writebit((bit)(dout&0x01));
dout=dout>>1;
}
delay(5);
}
void readtemp()
{
unsigned char n;
unsigned char buff[9];
EA=0;
reset();
writebyte(0xcc);
writebyte(0x44);
while(readbyte()==0xff);
reset();
writebyte(0xcc);
writebyte(0xbe);
for(n=0;n<9;n++)
{
buff[n]=readbyte();
delay(100);
}
mydata1=buff[0];
delay(10);
mydata1=mydata1>>4;
mydata2=buff[1];
delay(10);
mydata2=mydata2<<4;
mydata3=mydata2mydata1;
lcddata_number(mydata3);
//lcddelay(1);
delay(2500);
EA=1;
}
void lcdcmd(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
lcddelay(1);
en=0;
return;
}
void lcddata_number(unsigned char value)
{
char data1;
lcdcmd(0x8c);
delay(1000);
B=value;
data1=value%10;
value=value/10;
if(value>9)
{
ldata=1+0x30;
for(;value!=0;)
{
data1 =value%10;
ldata=data1+0x30;
rs=1;
rw=0;
en=1;
lcddelay(100);
en=0;
ldata=value%10+0x30;
rs=1;
rw=0;
en=1;
lcddelay(10);
en=0;
}
}
else
{
ldata=value+0x30;
lcddelay(10);
rs=1;
rw=0;
en=1;
lcddelay(10);
en=0;
}
ldata=data1+0x30;
rs=1;
rw=0;
en=1;
lcddelay(100);
en=0;
ldata='\0';
rs=1;
rw=0;
en=1;
lcddelay(100);
en=0;
return;
}
void lcddata(unsigned char *value)
{
char i;
for(i=0;value[i]!='\0';i++)
{
ldata=value[i];
rs=1;
rw=0;
en=1;
lcddelay(100);
en=0;
}
return;
}



void lcddelay(unsigned int time)
{
unsigned int i,j;
for(i=0;i<=time;i++)
{
for(j=0;j<=1000;j++);
}
}
void delay(int us)
{
int i;
for(i=0;i}

Discription
This circuit is useful for monitor industrial temperature upto 200 degees c
for more details please mail to sekharstuff@yahoo.co.in

Tuesday, October 14, 2008

SECURED ROOM ACESS SYSTEM



4 Resistors
R1 470
R21k
R3, R4 10k
2 Capacitors
Quantity: References Value
2 C1, C2 33p
2 Integrated Circuits
Quantity: Reference Value
1 U2 OPTOCOUPLER-NPN
1 U3 AT89C51
1 Transistors
Quantity: References Value
1 Q1 NPN
2 Diodes
Quantity: References Value
1 D1 DIODE
1 D2 LED
7 Miscellaneous
Quantity: References Value
2 B1, RL1 6v
1 L1 12V
1 LCD2 LM016L
2 SW1, SW2 SW-SPST
1 X1 CRYSTAL
C-PROGRAM

#include
#include
#define COL P3
#define ROW P0
//sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit access=P2^3;
char master_password[6]="22222";
void delay(unsigned int itime);
void lcdcmd(unsigned char value);
void lcddata(char *value);
void keyboard_reading(char );
void keyboard_key_press();
unsigned char keyboard[4][3]={ '1','2','3',
'4','5','6',
'7','8','9',
'*','0','#',};
char temporary_storage[6];
int i;
char ch;
void main()
{
while(1)
{
access=0;
lcdcmd(0x38);
delay(50);
lcdcmd(0x0e);
delay(50);
lcdcmd(0x01);
delay(25);
lcdcmd(0x06);
delay(50);
lcdcmd(0x81);
//delay(250);
lcddata("WELCOME");
//delay(250);
lcdcmd(0xc0);
lcddata("ENTER PASSWORD");
ch=0;
keyboard_key_press();
//password comparision
if(strcmp(master_password,temporary_storage)==0)
{
lcdcmd(0x01);
lcdcmd(0x81);
delay(25);
lcddata("THANKS");
lcdcmd(0xc1);
lcddata("YOU CAN ENTER");
access=1;
delay(25);
}
else
{
for(i=0;i<3;i++)
{
lcddata("PASSWORD IS WRONG");
delay(25);
lcdcmd(0x01);
lcddata("ENTER ONCE AGAIN");
delay(25);
ch=0;
keyboard_key_press();
if(strcmp(master_password,temporary_storage)==0)
{
lcdcmd(0x01);
lcdcmd(0x81);
delay(25);
lcddata("THANKS, YOU CAN ENTER");
access=1;
delay(1000);
delay(1000);
delay(1000);
delay(1000);
break;
}
lcdcmd(0x01);
if(i==2)
{
lcdcmd(0x01);
lcdcmd(0x81);
lcddata("INVALID PASSWORD");
lcdcmd(0xc1);
lcddata("CONTACT ADMINISTRATOR");
}
}
}
}
}
//functions declarations
void keyboard_reading(char value)
{
if(ch==0)
{
lcdcmd(0x01);
lcdcmd(0x81);
}
temporary_storage[ch]=value;
ch++;
// lcdcmd(0x01);
// lcdcmd(0x81);
delay(50);
lcddata("*");
// delay(100);
if(ch==5)
temporary_storage[ch]='\0';
return;
}
void lcdcmd(unsigned char value)
{
P1=value;
rs=0;
rw=0;
en=1;
delay(10);
en=0;
return;
}
void lcddata(char *value)
{
int m;
for(m=0;value[m]!='\0';m++)
{
delay(1);
P1=value[m];
rs=1;
rw=0;
en=1;
delay(1);
en=0;
}
return;
}
void delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}


void keyboard_key_press(void )
{
unsigned char colloc,rowloc;
//P0=0xff;
int m;
// COL=0xff;
for(m=0;m<=4;m++)
{
do
{
// delay(100);
ROW=0x00;
colloc=COL;
colloc&=0x0f;
}
while(colloc!=0x0f);
do
{
do
{
delay(20);
colloc=COL;
colloc&=0x0f;
}while(colloc==0x0f);
delay(20);
colloc=COL;
colloc&=0x0f;
} while(colloc==0x0f);
while(1)
{
ROW=0xfe;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=0;
break;
}
ROW=0xfd;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=1;
break;
}
ROW=0xfb;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=2;
break;
}
ROW=0xf7;
colloc=COL;
colloc&=0x0f;
rowloc=3;
break;
}
if(colloc==0x0e)
keyboard_reading(keyboard[rowloc][0]);
else if(colloc==0x0d)
keyboard_reading(keyboard[rowloc][1]);
else if(colloc==0x0b)
keyboard_reading(keyboard[rowloc][2]);
else // (colloc==0x07)
keyboard_reading(keyboard[rowloc][3]);
}
}
FOR FURTHER QUERIES PLEASE MAIL ME AT sekharstuff@yahoo.co.in

Thursday, June 19, 2008

Temperature measuring system with 89c51 interfacing with parellel DAC

Componente Required
IC 1 89c51
IC 2 ADC0801
Resistor 10K -1
Capacitor 33pf -2
150pf -1
POT or TEMPERATURE SENSOR -1
LED -8
Crystal Oscillator 11.054 Mhz
Schmatic diagram

Description

Teperature sensor sense the temperature and it will give corresponding analog output signal the signal read by the ADC and convert into a digital value and send it to microcontroller. In this circuit we display the corresponding value using LEDs

For further developments please contact sekharstuff@gmail.com

C program

#include
sbit CS=P1^0;
sbit READ=P1^1;
sbit WRITE=P1^2;
sbit INTR=P1^3;
//sfr MYDATA=P2;
void delay()
{
int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=10;j++);
}
void main()
{
unsigned char value;
P2=0xff;
INTR=1;
READ=1;
WRITE=1;
while(1)
{
WRITE=0; //take analog input
WRITE=1; //L to H
while(INTR==1); //INTR=0 end of conversion
READ=0; //read value into controller
value=P2;
// delay();
P3=value;
// delay();
READ=1;
}
}

Hex file

:0300000002003AC1
:0C003A00787FE4F6D8FD758107020020F5
:10000300E4FFFEE4FDFC0DBD00010CED640B4C7040
:0C001300F50FBF00010EBE03EABFE9E7D5
:01001F0022BE
:1000200075A0FFD293D291D292C292D2922093FD28
:0A003000C291AFA08FB0D29180EF13
:00000001FF

Wednesday, June 18, 2008

Stepper Motor interfacing with 8051

Components Required


Atmel 89c51 controller


crystal oscillator 11.059 Mhz


capacitor 33pfarads -2


Bipolar stepper motor


resistors -1K -2


push bottons -2


Driver IC ULN 2003A -1


Circuit Diagram






Description

If you press one push botton motor will rotate one direction. If you press another button it start rotating in the other direction.Speed of the motor we can control by using delay routine in C programing.

C program


#include
#define no_of_rotations 4
sbit m= P0^0;
sbit n=P0^1;

void delay()
{
int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=100;j++);
}
main()
{
int forward,reverse,x;
forward=0x01;
reverse=0x08;
x=no_of_rotations;
while(1)
{
if(m==0)
{
while(x!=0)
{
P1=forward;
forward<<=1;
delay();
if(forward==0x10)
forward=0x01;
}
x--;
}
if(n==0)
{
while(x!=0)
{
P1=reverse;
reverse>>=1;
delay();
if(reverse==0x00)
reverse=0x08;
}
x--;
}
}
}

HEX code

:0300000002008774
:0C008700787FE4F6D8FD758109020003C3
:10006A00E4FFFEE4FDFC0DBD00010CED64654C707F
:0C007A00F50FBF00010EBE03EABFE9E76E
:010086002257
:100003007508007509017B087A0090000420802E92
:10001300E58245836020850990E50925E0F509E53A
:100023000833F50812006AE5096410450870E1F524
:100033000875090180DAE582158270021583208133
:10004300CCE582458360168B90EAA2E713FAEB13A3
:10005300FB12006AEB4A70E9FA7B0880E4E582153B
:070063008270AA158380A63C
:00000001FF


Tuesday, June 17, 2008

KEY BOARD interfacing with 89C51

Components Required:
89c51 micro controller
crystal oscillator -11.051 Mhz
capacitors -2 (33 p farad)
Matrix keyboard
LED
Circuit Diagram



Description
If you press any button in the matrix keyboard it controller will scan the corresponding ascii code that will send serially to the port pin specified . Corresponding ascii code we can see in LED blinkings.
C program
#include
#define COL P2
#define ROW P1
void msdelay(unsigned int value);
void sertx(unsigned char);
unsigned char keyboard[4][4]={ '7','8','9','/',
'4','5','6','*',
'1','2','3','-',
'a','0','=','+' };

void main()
{
unsigned char colloc,rowloc;
TMOD=0x20;
TH1=-24;
SCON=0x50;
TR1=1;
COL=0xff;
while(1)
{
do
{
ROW=0x00;
colloc=COL;
colloc&=0x0f;
} while(colloc!=0x0f);
do
{
do
{
msdelay(20);
colloc=COL;
colloc&=0x0f;
}while(colloc==0x0f);
msdelay(20);
colloc=COL;
colloc&=0x0f;
} while(colloc==0x0f);
while(1)
{
ROW=0xfe;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=0;
break;
}
ROW=0xfd;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=1;
break;
}
ROW=0xfb;
colloc=COL;
colloc&=0x0f;
if(colloc!=0x0f)
{
rowloc=2;
break;
}
ROW=0xf7;
colloc=COL;
colloc&=0x0f;
rowloc=3;
break;
}
if(colloc==0x0e)
sertx(keyboard[rowloc][0]);
else if(colloc==0x0d)
sertx(keyboard[rowloc][1]);
else if(colloc==0x0b)
sertx(keyboard[rowloc][2]);
else // (colloc==0x07)
sertx(keyboard[rowloc][3]);
}
}
void sertx(unsigned char x)
{
SBUF=x;
while(TI==0);
msdelay(20);
TI=0;
}
void msdelay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<=1275;i++)
for(j=0;j<=value;j++);
}
HEX code


:030000000200CA31
:0C00CA00787FE4F6D8FD75811902011161
:10017A0010083738392F3435362A3132332D613069
:02018A003D2B0B
:10000300758920758DE8759850D28E75A0FFE4F53B
:100013009085A01853180FE518B40FF212015685F6
:10002300A01853180FE518640F60F112015685A04C
:100033001853180FE518640F60E27590FE85A01839
:1000430053180FE518640F6005E4F51980347590B3
:10005300FD85A01853180FE518640F600575190185
:1000630080207590FB85A01853180FE518640F6066
:1000730005751902800C7590F785A01853180F7534
:100083001903E518B40E0AE51925E025E0240880D4
:100093001CE518B40D0AE51925E025E02409800DB7
:1000A300E518B40B11E51925E025E0240AF8E6FF6D
:1000B30012018D020011E51925E025E0240BF8E675
:0700C300FF12018D02001184
:0B018D008F993099FD120156C2992293
:040156007F147E0094
:10015A00E4FDFCE4FBFAD3EB9FEA9E50070BBB00DD
:0F016A00010A80F20DBD00010CBC04E7BDFCE4EE
:010179002263
:1000D600020003E493A3F8E493A34003F68001F23D
:1000E60008DFF48029E493A3F85407240CC8C3332B
:1000F600C4540F4420C8834004F456800146F6DFFA
:10010600E4800B010204081020408090017AE47E0E
:10011600019360BCA3FF543F30E509541FFEE493EE
:10012600A360010ECF54C025E060A840B8E493A3B5
:10013600FAE493A3F8E493A3C8C582C8CAC583CAE0
:10014600F0A3C8C582C8CAC583CADFE9DEE780BE98
:01018C000072
:00000001FF

For C programe please mail to sekharstuff@yahoo.co.in

4 CHANNEL ADC


HEX code

:0300000002008A71
:0C008A00787FE4F6D8FD758107020003C2
:0E005F00C2A112006DE5F025E0F5F012006D73
:10006D00E4FFFEE4FDFC0DBD00010CED640A4C70D7
:0C007D00F50FBF00010EEF64644E70E749
:010089002254
:1000030075F0C0C2A0E4FBD2A112006D12006D1204
:10001300006DA2F792A212006D12006D12005F0B29
:10002300BB05E412006D12006D12006D12006DC26B
:10003300A112006DD2A112006DC2A112006DE4FBEA
:10004300D2A112006D12006DA2A392F012005F0BF9
:0B005300BB08EDD2A012006D85F090FC
:01005E00227F
:00000001FF
For C program please mail to sekharstuff@gmail.com

LCD interfacing


HEX code

:03000000020003F8
:0C000300787FE4F6D8FD75811102004AF8
:1001550077656C636F6D6520746F20677269657470
:1001650000746869732069732073656B6861720038
:100190000308FF0155030BFF0166020E0000021069
:0201A00000005D
:10008F007F381201A31201317F0E1201A312013129
:10009F007F011201A31201317F061201A312013158
:1000AF007F811201A3801EAB08AA09A90A850F82BE
:1000BF00850E831201046012050FE50FAE0E70025C
:1000CF00050E12017512013180DD7FC11201A3806F
:1000DF001EAB0BAA0CA90D8511828510831201048A
:1000EF0060120511E511AE107002051012017512A4
:0500FF00013180DD224B
:1001A3008F90C2A0C2A1D2A27F017E00120135C2EC
:0201B300A22286
:0901750014F5828E83120104FFCF
:10017E008F90D2A0C2A1D2A27F017E00120135C201
:02018E00A222AB
:040131007FFA7E00D3
:10013500E4FDFCD3ED9FEC9E5015E4FBFA0BBB00F0
:0F014500010ABA04F8BBFCF50DBD00010C80E403
:010154002288
:10000F0002008FE493A3F8E493A34003F68001F278
:10001F0008DFF48029E493A3F85407240CC8C333F2
:10002F00C4540F4420C8834004F456800146F6DFC1
:10003F00E4800B0102040810204080900190E47EC0
:10004F00019360BCA3FF543F30E509541FFEE493B6
:10005F00A360010ECF54C025E060A840B8E493A37D
:10006F00FAE493A3F8E493A3C8C582C8CAC583CAA8
:10007F00F0A3C8C582C8CAC583CADFE9DEE780BE60
:0101A200005C
:10010400BB010CE58229F582E5833AF583E02250B0
:1001140006E92582F8E622BBFE06E92582F8E222FA
:0D012400E58229F582E5833AF583E4932214
:00000001FF
For C program please mail to sekharstuff@gmail.com

SINGLE CHANNEL ADC


HEX code

:03000000020051AA
:0C005100787FE4F6D8FD758107020003FB
:07002D00D2A1120034C2A1B0
:10003400E4FFFEE4FDFC0DBD00010CED640A4C7010
:0C004400F50FBF00010EBE03EABFE8E7A5
:01005000228D
:10000300C2A012002F12002DE4FB12002DA2A39216
:10001300F0E5F025E0F5F01200341200340BBB08D4
:09002300E9D2A012003485F0902E
:01002C0022B1
:00000001FF
For C program please mail to sekharstuff@gmail.com

DANCING LEDs







C programe

#include
#define first P1
#define second P2
//sbit first P1^0
//sbit second P2^0
void wait()
{
int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=10;j++);
}
main()
{
unsigned int i; /* Delay var */
unsigned char j,m; /* LED var */
while (1)
{
for(m=0x01;m!=0xff;m=m(m<<1))
{
for(i=1;i<=7;i++)
{ /* Loop forever */
for (j=m; j!= 0x00; j<<=i) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */
P1 = j; /* Output to LED Port */
wait (); /* call wait function */
}
P1=0;
for (j=m; j!=0x00; j<<=i) { /* Blink LED 6, 5, 4, 3, 2, 1 */
P2 = j; /* Output to LED Port */
wait ();
} /* call wait function */
P2=0;
}
}
}
}

Hex code

:0300000002007784
:0C007700787FE4F6D8FD758108020003D4
:10005A00E4FFFEE4FDFC0DBD00010CED640B4C70E9
:0C006A00F50FBF00010EBE03EABFE9E77E
:010076002267
:10000300750801E508F460F87B017A00A908E96046
:1000130014F59012005AAF03E9A807088002C3330E
:10002300D8FCF980E9E4F590A908E96014F5A01279
:10003300005AAF03E9A807088002C333D8FCF9804C
:10004300E9E4F5A00BBB00010AEB64084A70BDE5C7
:070053000825E0420880AC23
:00000001FF



for further details please contact sekhar 9490081918 Email: sekharstuff@gmail.com