here is the adc pgm interfacing with lcd..i m having doubt on this c code
#include<pic.h>
#define _XTAL_FREQ 20000000
void conversion(unsigned int rx_con);
void command(unsigned int rx_cmd);
void string(unsigned char *rs_string);
void data(unsigned int rx_data);
void main()
{
unsigned int a,b,e,f,c,d;
TRISA1=1;
TRISE=0x00;
TRISB=0x00;
ADCON0=0x0d;
ADCON1=0x82;
command(0x01);
command(0x06);
command(0x0c);
command(0x38);
command(0x80);
while(1)
{
{
ADGO=1;
while(ADGO==1);
//pls explain thse steps alone sir..i couldn’t fix it..what about 256 & 49
a=ADRESH;
b=ADRESL;
a=a*256;
c=a+b;
c=c*.49;
conversion(c);
command(0x80);
data('T');
}
}
}
void command(unsigned int rx_cmd)
{
PORTE=0x04;
PORTB=rx_cmd;
__delay_ms(10);
RE2=0;
}
void data(unsigned int rx_data)
{
PORTE=0x05;
PORTB=rx_data;
__delay_ms(10);
RE2=0;
}
void conversion(unsigned int rx_con)
{
data(((rx_con/1000)+0x30));
data((((rx_con%1000)/100)+0x30));
data(((((rx_con%1000)%100)/10)+0x30));
data(((((rx_con%1000)%100)%10)+0x30));
}
#include<pic.h>
#define _XTAL_FREQ 20000000
void conversion(unsigned int rx_con);
void command(unsigned int rx_cmd);
void string(unsigned char *rs_string);
void data(unsigned int rx_data);
void main()
{
unsigned int a,b,e,f,c,d;
TRISA1=1;
TRISE=0x00;
TRISB=0x00;
ADCON0=0x0d;
ADCON1=0x82;
command(0x01);
command(0x06);
command(0x0c);
command(0x38);
command(0x80);
while(1)
{
{
ADGO=1;
while(ADGO==1);
//pls explain thse steps alone sir..i couldn’t fix it..what about 256 & 49
a=ADRESH;
b=ADRESL;
a=a*256;
c=a+b;
c=c*.49;
conversion(c);
command(0x80);
data('T');
}
}
}
void command(unsigned int rx_cmd)
{
PORTE=0x04;
PORTB=rx_cmd;
__delay_ms(10);
RE2=0;
}
void data(unsigned int rx_data)
{
PORTE=0x05;
PORTB=rx_data;
__delay_ms(10);
RE2=0;
}
void conversion(unsigned int rx_con)
{
data(((rx_con/1000)+0x30));
data((((rx_con%1000)/100)+0x30));
data(((((rx_con%1000)%100)/10)+0x30));
data(((((rx_con%1000)%100)%10)+0x30));
}