Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Here's the code which display the values on LCD and sends them through GSM. There might be some error that maybe causing the simulation error. Can you figure it out?You need to post the code.... You are accessing eeprom data outside the limit of the device selected
char str1[]="OK";
char AT[]="AT";
char terminator=0x1A;
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
float v;
char txt[5];
char txt1[5];
void voltage_READ(void)
{
float max;
int i;
int t[40];
ADCON0.ADON=1;
for(i=0; i<=39; i++)
{
v= ADC_Read(0); //Digital value convert
v =v*(10.0/1023.0);
v=(v-5.0);
t[I]=v*110.1909091;
}
ADCON0.ADON=0;
max=t[0];
for(i=0; i<=39; i++)
{
if(max<t[I])
max=t[I];
}
max=max*.707106781;
intToStr(max, txt);
Lcd_out(1,9,txt);
delay_ms(1000);
}
void current_READ(void)
{
float max;
int i,current;
int t[40];
ADCON0.ADON=1;
for(i=0; i<=39; i++)
{
v= ADC_Read(1);
v =v*(10.0/1023.0);
v=(v-5.0);
t[I]=v*10;
}
ADCON0.ADON=0;
maxi=t[0];
for(i=0; i<=39; i++)
{
if(max<t[I])
maxi=t[I];
}
max=max*.707106781;
intToStr(max, txt1);
Lcd_out(2,8,txt1);
delay_ms(1000);
}
void main()
{ while(1)
{
Lcd_out(1,1, "Voltage:");
Lcd_out(2,1, "Current:");
voltage_READ();
current_READ();
}
TRISC=0;
char output[5];
Lcd_Init(); // Initialize LCD
ADCON0.ADCS1=1;
ADCON0.ADCS1=0;
ADCON0.ADON=0;
UART1_init(9600); //initialize UART
UART1_write(AT);
Delay_ms(100);
UART1_Read_Text(output, "OK", 10);
while(strcmp(str1,output)==0);
UART1_write("AT+CMGF=1");
Delay_ms(100);
UART1_Read_Text(output, "OK", 10);
while(strcmp(str1,output)==0) ;
UART1_write("AT+CMGS=03027567568");
Delay_ms(100);
UART1_write(txt1);
UART1_write(txt);
UART1_write(terminator);
}
How to change the 0ffset?The EEPROM is located from 2100h-21FFh
You only need to know this if you are going to initialise the EEPROM in your source code, in which case you need an ORG 2100h before the DE statements.
When accessing the EEPROM in your code, this address is irrelevant, because you only specify an 8 bit offset into the EEPROM.
Also, why are your Crystal caps 1uF? Shouldn't they be in the lower pF range?