Google

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