0% found this document useful (0 votes)
16 views10 pages

Start: #Include

The document describes code for a glucose monitoring system that displays readings on an LCD screen and sends SMS alerts to staff if glucose levels are low. It initializes the LCD, defines functions for sending commands and data to the LCD, and includes a main loop that checks the sensor input and sends SMS messages with room and bed numbers if the input is low, triggering a buzzer alert as well.

Uploaded by

Sebastin Ashok
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views10 pages

Start: #Include

The document describes code for a glucose monitoring system that displays readings on an LCD screen and sends SMS alerts to staff if glucose levels are low. It initializes the LCD, defines functions for sending commands and data to the LCD, and includes a main loop that checks the sensor input and sends SMS messages with room and bed numbers if the input is low, triggering a buzzer alert as well.

Uploaded by

Sebastin Ashok
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Start

Displaying unit

Scanning the sensor


output

If its low level

Sending sms to the


particular staff

Stop
#include <REGX51.H>

sbit rs=P3^2;
sbit rw=P3^3;
sbit en=P3^4;

sfr datas=0xA0;
sbit buzz=P1^7;

void lcdinit(void);
void lcdcmd(unsigned char );
void delay(unsigned int del);
void lcddata(unsigned char ldat);

void INITLCD();
void COMMAND(unsigned char val);
void DISPLAY(unsigned char val);

void INITLCD()
{
lcdinit();
}

unsigned char tf,hf,pf,mf,j,val2,val3,val4;

unsigned char temp,hum,res;

unsigned char cost1,cost2;

void COMMAND(unsigned char val)


{
lcdcmd(val);
}
void DISPLAY(unsigned char val)
{
lcddata(val);
}

void lcdinit(void)
{
lcdcmd(0x38);
lcdcmd(0x38);
lcdcmd(0x38);
lcdcmd(0x06);
lcdcmd(0x0e);
lcdcmd(0x01);
lcdcmd(0x0C);
lcdcmd(0x80);
}

void lcdcmd(unsigned char lcmd)


{
datas=lcmd;

rs=0;
rw=0;
en=1;
delay(100);
en=0;
}

void delay(unsigned int del)


{
while(del--);
}

void lcddata(unsigned char ldat)


{
datas=ldat;
rs=1;
rw=0;
en=1;
delay(100);
en=0;
}

unsigned char rval[76];

void putchar(unsigned char val[16],char len)


{
char i;
for(i=0;i<len;i++)
{
DISPLAY(val[i]);
}
}

void delay1()
{
long i;
for(i=0;i<50000;i++);
}

void txs(unsigned char val)


{
//int i;
TI=0;
SBUF=val;
//for(i=0;i<3600;i++);
while(TI==0);
}

unsigned char rxs()


{
int c=0;
char val;
while(RI==0)
{

val=P3_5;
val3++;
if(val==1)
{
if(val2>100)
{
val2=val2-50;
}
val2++;
}

val4=val2;
c++;
if(c>5000)
break;

RI=0;
return SBUF;
}

void sendd()
{

txs('A');txs('T');txs('+');txs('C');txs('M');txs('G');
txs('S');txs('=');
txs('9');txs('9');txs('4');txs('0');
txs('9');txs('1');txs('1');txs('2');txs('5');txs('6');
txs(13); txs(10);
}
void sendd1()
{
txs('A');txs('T');txs('+');txs('C');txs('M');txs('G');
txs('S');txs('=');
txs('8');txs('8');txs('7');txs('0');
txs('5');txs('2');txs('5');txs('6');txs('7');txs('2');
txs(13); txs(10);
}
/*
void sendd()

{
txs('A');txs('T');txs('+');txs('C');txs('M');txs('G');
txs('S');txs('=');
txs('8');txs('9');txs('0');txs('3');
txs('4');txs('6');txs('8');txs('0');txs('1');txs('4');
txs(13);
}
*/

void sms2()
{
sendd();
sendd1();
delay(100);
txs('l');txs('o');txs('w');txs(' ');txs('l');txs('e');txs('v');txs('e');txs('l'); txs(' ');
txs('A'); txs('l');txs('e');txs('r'); txs('t');txs(' ');
txs('o'); txs('n');txs(' ');
txs('R'); txs('o');txs('o');txs('m'); txs('.');txs('N'); txs('o');txs(':');txs('2'); txs('3');
txs('a'); txs('t');txs(' ');txs('B');txs('e');txs('d'); txs('.');txs('N'); txs('o');txs(':');
txs('3');txs(13);
txs(26);
}

txs(10);

delay(10000);

void main()
{

SCON=0x50;
TMOD=0x20;
TH1=0xfd;
TR1=1;

temp=2;

txs('A');txs('T');txs('+');txs('I');txs
txs('=');txs('0');txs(',');txs('0');txs(13);
txs('A');txs('T');txs(13); txs(10);
txs('A');txs('T');txs('+'); txs('M');txs('G');
txs('F');txs('=');txs('1');txs(13);

txs(10);

INITLCD();
lcdcmd(0x80);
putchar("Glucose monitor ",16);
lcdcmd(0xC0);
putchar("R.No:23 ",7);
lcdcmd(0xc8);
putchar("Bed.No:3 ",8);

while(1)
{
if(P1^0==1)
{
buzz=1;
sms2();

}
else if(P1^0==0)

{
buzz=0;
}
else
{
buzz=0;
}

}
}

You might also like