// LCD module connections
sbit LCD_RS at P3_0_bit;
sbit LCD_EN at P3_1_bit;
sbit LCD_D4 at P3_2_bit;
sbit LCD_D5 at P3_3_bit;
sbit LCD_D6 at P3_4_bit;
sbit LCD_D7 at P3_5_bit;
// End LCD module connections
#define ADC_SC P2_6_bit // set the start pin to P2_0
#define ADC_EOC P2_7_bit // set the End of Conversion to p2_1
#define ADC_OE P2_5_bit // set the output enable to p2_2
#define ADC_ALE P2_4_bit // aet the Adress Latch Enable to P2_4
#define ADD_A P2_2_bit
#define ADD_B P2_1_bit
#define ADD_C P2_0_bit
#define ADC_DATA P1 // set the 8-bit data to p0 port.
void adc_init();
unsigned char adc_getdata();
double d_adc_val;
unsigned char getdata, adc_val;
char str_adc_val[17];
char txt1[] = "A Project by";
char txt2[] = "Smitha B T";
/*---------------------------------------------------------------------
Initialize the adc
void adc_init();
---------------------------------------------------------------------*/
void adc_init() //
{
ADC_EOC = 1;
//P1 = 0xFF;
ADC_ALE = 0;
ADC_OE = 0;
ADC_SC = 0;
ADD_A = 0;
ADD_B = 0;
ADD_C = 0;
Delay_ms(2);
}
/*---------------------------------------------------------------------
Get the data from ADC
unsigned char adc_getdata(void);
---------------------------------------------------------------------*/
unsigned char adc_getdata()
{
ADC_ALE = 1; // enable ALE
Delay_ms(2);
ADC_SC = 1; // Start the ADC conversion
Delay_ms(1);
ADC_ALE = 0;
Delay_ms(1);
ADC_SC = 0;
Delay_ms(1);
// Waiting for Conversion end
while(ADC_EOC == 1);
while(ADC_EOC == 0);
ADC_OE = 1; // set the Output Enable
Delay_ms(1);
getdata = ADC_DATA; // Get the ADC data
ADC_OE = 0; // clear the Output Enable
return getdata;
}
void main(){
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear Display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
LCD_Out(1,3,txt1); // Write text in first row
LCD_Out(2,4,txt2); // Write text in second row
Delay_ms(2000); // 3 sec delay
Lcd_Cmd(_LCD_CLEAR); // Clear Display
adc_init();
while(1) {
adc_val = adc_getdata(); // read adc input and assign the value to adc_val
d_adc_val = adc_val * 0.588235524798245;
FloatToStr(d_adc_val, str_adc_val); // convert adc_val to string
Lcd_Out(1,3,"Temperature"); //
Lcd_Out(2,3,str_adc_val); // Display adc value
}
}
d_adc_val = adc_val * 0.588235524798245;
FloatToStr(d_adc_val, str_adc_val); // convert adc_val to string
// LCD module connections
sbit LCD_RS at P3_0_bit;
sbit LCD_EN at P3_1_bit;
sbit LCD_D4 at P3_2_bit;
sbit LCD_D5 at P3_3_bit;
sbit LCD_D6 at P3_4_bit;
sbit LCD_D7 at P3_5_bit;
// End LCD module connections
#define ADC_SC P2_6_bit // set the start pin to P2_0
#define ADC_EOC P2_7_bit // set the End of Conversion to p2_1
#define ADC_OE P2_5_bit // set the output enable to p2_2
#define ADC_ALE P2_4_bit // aet the Adress Latch Enable to P2_4
#define ADD_A P2_2_bit
#define ADD_B P2_1_bit
#define ADD_C P2_0_bit
#define ADC_DATA P1 // set the 8-bit data to p0 port.
void adc_init();
unsigned char adc_getdata();
int d_adc_val;
unsigned char getdata, adc_val;
char str_adc_val[17];
char txt1[] = "A Project by";
char txt2[] = "Smitha B T";
/*---------------------------------------------------------------------
Initialize the adc
void adc_init();
---------------------------------------------------------------------*/
void adc_init() //
{
ADC_EOC = 1;
//P1 = 0xFF;
ADC_ALE = 0;
ADC_OE = 0;
ADC_SC = 0;
ADD_A = 0;
ADD_B = 0;
ADD_C = 0;
Delay_ms(2);
}
/*---------------------------------------------------------------------
Get the data from ADC
unsigned char adc_getdata(void);
---------------------------------------------------------------------*/
unsigned char adc_getdata()
{
ADC_ALE = 1; // enable ALE
Delay_ms(2);
ADC_SC = 1; // Start the ADC conversion
Delay_ms(1);
ADC_ALE = 0;
Delay_ms(1);
ADC_SC = 0;
Delay_ms(1);
// Waiting for Conversion end
while(ADC_EOC == 1);
while(ADC_EOC == 0);
ADC_OE = 1; // set the Output Enable
Delay_ms(1);
getdata = ADC_DATA; // Get the ADC data
ADC_OE = 0; // clear the Output Enable
return getdata;
}
void main(){
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear Display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
LCD_Out(1,3,txt1); // Write text in first row
LCD_Out(2,4,txt2); // Write text in second row
Delay_ms(2000); // 3 sec delay
Lcd_Cmd(_LCD_CLEAR); // Clear Display
adc_init();
while(1) {
adc_val = adc_getdata(); // read adc input and assign the value to adc_val
IntToStr(adc_val, str_adc_val); // convert adc_val to string
Lcd_Out(1,3,"Temperature"); //
Lcd_Out(2,3,str_adc_val); // Display adc value
}
}
// LCD module connections
sbit LCD_RS at P3_0_bit;
sbit LCD_EN at P3_1_bit;
sbit LCD_D4 at P3_2_bit;
sbit LCD_D5 at P3_3_bit;
sbit LCD_D6 at P3_4_bit;
sbit LCD_D7 at P3_5_bit;
// End LCD module connections
#define ADC_SC P2_6_bit // set the start pin to P2_0
#define ADC_EOC P2_7_bit // set the End of Conversion to p2_1
#define ADC_OE P2_5_bit // set the output enable to p2_2
#define ADC_ALE P2_4_bit // aet the Adress Latch Enable to P2_4
#define ADD_A P2_2_bit
#define ADD_B P2_1_bit
#define ADD_C P2_0_bit
#define ADC_DATA P1 // set the 8-bit data to p0 port.
void adc_init();
unsigned char adc_getdata();
int d_adc_val;
unsigned char getdata, adc_val;
char str_adc_val[17];
char txt1[] = "A Project by";
char txt2[] = "Smitha B T";
/*---------------------------------------------------------------------
Initialize the adc
void adc_init();
---------------------------------------------------------------------*/
void adc_init() //
{
ADC_EOC = 1;
//P1 = 0xFF;
ADC_ALE = 0;
ADC_OE = 0;
ADC_SC = 0;
ADD_A = 0;
ADD_B = 0;
ADD_C = 0;
Delay_ms(2);
}
/*---------------------------------------------------------------------
Get the data from ADC
unsigned char adc_getdata(void);
---------------------------------------------------------------------*/
unsigned char adc_getdata()
{
ADC_ALE = 1; // enable ALE
Delay_ms(2);
ADC_SC = 1; // Start the ADC conversion
Delay_ms(1);
ADC_ALE = 0;
Delay_ms(1);
ADC_SC = 0;
Delay_ms(1);
// Waiting for Conversion end
while(ADC_EOC == 1);
while(ADC_EOC == 0);
ADC_OE = 1; // set the Output Enable
Delay_ms(1);
getdata = ADC_DATA; // Get the ADC data
ADC_OE = 0; // clear the Output Enable
return getdata;
}
void main(){
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear Display
adc_init();
while(1) {
adc_val = adc_getdata(); // read adc input and assign the value to adc_val
IntToStr(adc_val, str_adc_val); // convert adc_val to string
Lcd_Out(1,3,"Temperature"); //
Lcd_Out(2,3,str_adc_val); // Display adc value
}
}
// LCD module connections
sbit LCD_RS at P3_0_bit;
sbit LCD_EN at P3_1_bit;
sbit LCD_D4 at P3_2_bit;
sbit LCD_D5 at P3_3_bit;
sbit LCD_D6 at P3_4_bit;
sbit LCD_D7 at P3_5_bit;
// End LCD module connections
#define ADC_SC P2_6_bit // set the start pin to P2_0
#define ADC_EOC P2_7_bit // set the End of Conversion to p2_1
#define ADC_OE P2_5_bit // set the output enable to p2_2
#define ADC_ALE P2_4_bit // aet the Adress Latch Enable to P2_4
#define ADD_A P2_2_bit
#define ADD_B P2_1_bit
#define ADD_C P2_0_bit
#define ADC_DATA P1 // set the 8-bit data to p0 port.
void adc_init();
unsigned char adc_getdata();
int d_adc_val;
unsigned char getdata, adc_val;
char str_adc_val[17];
char txt1[] = "A Project by";
char txt2[] = "Smitha B T";
/*---------------------------------------------------------------------
Initialize the adc
void adc_init();
---------------------------------------------------------------------*/
void adc_init() //
{
ADC_EOC = 1;
//P1 = 0xFF;
ADC_ALE = 0;
ADC_OE = 0;
ADC_SC = 0;
ADD_A = 0;
ADD_B = 0;
ADD_C = 0;
Delay_ms(2);
}
/*---------------------------------------------------------------------
Get the data from ADC
unsigned char adc_getdata(void);
---------------------------------------------------------------------*/
unsigned char adc_getdata()
{
ADC_ALE = 1; // enable ALE
Delay_ms(2);
ADC_SC = 1; // Start the ADC conversion
Delay_ms(1);
ADC_ALE = 0;
Delay_ms(1);
ADC_SC = 0;
Delay_ms(1);
// Waiting for Conversion end
while(ADC_EOC == 1);
while(ADC_EOC == 0);
ADC_OE = 1; // set the Output Enable
Delay_ms(1);
getdata = ADC_DATA; // Get the ADC data
ADC_OE = 0; // clear the Output Enable
return getdata;
}
void main(){
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear Display
adc_init();
while(1) {
adc_val = adc_getdata(); // read adc input and assign the value to adc_val
adc_val = adc_val *100;
IntToStr(adc_val, str_adc_val); // convert adc_val to string
Lcd_Out(1,3,"Temperature"); //
Lcd_Out(2,3,str_adc_val); // Display adc value
}
}
#include<reg51.h>
sbit ale=P2^4;
sbit oe=P2^5;
sbit sc=P2^6;
sbit eoc=P2^7;
sbit ADD_A=P2^2;
sbit ADD_B=P2^1;
sbit ADD_C=P2^0;
void delay(unsigned int count)
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<1275;j++);
}
void main()
{
eoc=1;
P1=0xFF;
ale=0;
oe=0;
sc=0;
while(1)
{
ADD_C=0;
ADD_B=0;
ADD_A=0;
delay(2);
ale=1;
delay(2);
sc=1;
delay(1);
ale=0;
delay(1);
sc=0;
while(eoc==1);
while(eoc==0);
oe=1;
P3=P1;
delay(2);
oe=0;
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?