EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / thanks for your interest in

thanks for your interest in

|

Projects › Projects › Realtime energy meter reading using GSM › thanks for your interest in

March 2, 2013 at 2:20 pm #9218
Prab X
Participant

thanks for your interest in my project. I developed a code which will count 1000 pulses and increment unit =unit+1. i have not used external interrupt (INT0 PIN3.2 of AT89C51). Please developed this code using EXT INTERRUPT (INT0) & also help me to send the LCD display content by SMS to user after every 100 units consumed.

 

MY Code:

 

#include<reg51.h>
#define LCD P2
 
unsigned int Count,Unit,d1,d2,d3,d4,x1,x2,x3,d5,d6,d7,d8,x4,x5,x6,x7;
 
sbit rs = P1^0;
sbit rw = P1^1;
sbit en = P1^2;
sbit Pulse = P1^3;
 
 
void LCDInit ( );
void lcdcmd (unsigned char );
void lcdwrt (unsigned char );
void Delay (unsigned int );
void Conv1 (unsigned int );
void Conv2 (unsigned int );
void main(void)
{
unsigned char z,Disp;
unsigned char code str1[]=”ENERGY METER”;
//unsigned char code str2[]=”PULSE: 0000      “;
unsigned char code str2[]=”METER ID:XXX      “;
unsigned char code str3[]=”UNITS: 0000      “;
P0=0x00;
P1=0x00;
P2=0x00;
P3=0x00;
 
 
Count=0x00;
Unit=0x00;
 
LCDInit();
 
    for(z=0;z<16;z++)
{
 
Disp=str1[z];
lcdwrt(Disp);
Delay(1);
 
lcdcmd(0x80);
 
    for(z=0;z<16;z++)
{
 
Disp=str2[z];
lcdwrt(Disp);
Delay(1);
 
}
Delay(70);
lcdcmd(0xC0);
 
    for(z=0;z<16;z++)
{
 
Disp=str3[z];
lcdwrt(Disp);
Delay(1);
}
Delay(70);
 
 
while(1)
{
Delay(30);
if(Pulse==0)
{
 
Count=Count+1;
Conv1(Count);
Conv2(Unit);
if(Count==1000){
Count=0x00;
Unit=Unit+1;
 
}
 
}  
}
}
 
}
 
void Conv1(unsigned int val1)
{
x1 = val1 / 10;
d1 = val1 % 10;
 
x2 = x1 / 10;
d2 = x1 % 10;
 
x3 = x2 / 10;
d3 = x2 % 10;   
 
d4 = x3 % 10;
 
d1=d1+0x30;
d2=d2+0x30;
d3=d3+0x30;
d4=d4+0x30;
 
 
}
 
void Conv2(unsigned int val2)
{
x4 = val2 / 10;
d5 = val2 % 10;
 
x5 = x4 / 10;
d6 = x4 % 10;
 
x6 = x5 / 10;
d7 = x5 % 10;   
 
d8 = x6 % 10;
 
d5=d5+0x30;
d6=d6+0x30;
d7=d7+0x30;
d8=d8+0x30;
 
lcdcmd(0xc7);
lcdwrt(d8);
lcdwrt(d7);
lcdwrt(d6);
lcdwrt(d5);
Delay(1);
 
 
Delay(30);
}
 
void LCDInit()
{
lcdcmd(0x38);
Delay(10);
lcdcmd(0x0E);
Delay(10);
lcdcmd(0x01);
Delay(10);
lcdcmd(0x0C);
Delay(10);
lcdcmd(0x80);
Delay(10);
return;
}
 
void lcdcmd(unsigned char value)
{
LCD=value;
rs=0;
rw=0;
en=1;
Delay(1);
en=0;
return;
}
 
void lcdwrt(unsigned char value)
{
LCD=value;
rs=1;
rw=0;
en=1;
Delay(1);
en=0;
return;
}
 
 
 
void Delay(unsigned int x)
{
unsigned int i,j;
    for (i=0;i<=x;i++)
    for (j=0;j<=500;j++);
}
 
wysiwyg_imageupload:7681:

RSS Recent Posts

  • Do i need a buffer? February 7, 2026
  • ANOTHER OLD PROJECT REDO February 7, 2026
  • wall transformer polarity February 7, 2026
  • Supply vs performance query February 7, 2026
  • BPF February 7, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise