Microcontroller › 8051 › getting error help me
- This topic has 2 replies, 3 voices, and was last updated 6 years, 10 months ago by Ashutosh Bhatt.
-
AuthorPosts
-
April 23, 2013 at 7:46 am #2302guruParticipant
//Program to display temperature in Celsius and Farenheit scale.
#include<reg51.h>
#include”DELAY.h”
#include”LCD.h”
#include”ADC.h”
#include”SERIAL.h”
#include”STRING.h”
#define port P2
#define sec 100
sbit rs = port^0;
sbit rw = port^1;
sbit e = port^2;int test_intermediate3=0, test_final=0,test_intermediate1[10],test_intermediate2[3]={0,0,0};
void shape() // Function to make the shape of degree symbol
{
lcd_cmd(64);
lcd_data(2);
lcd_data(5);
lcd_data(2);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(0);
}
void convert() // Function to convert the values of ADC into numeric value to be sent to LCD
{
int s;
lcd_cmd(0x81);
delay(2);
lcd_data_string(“TEMP:”);
test_final=(((9*test_intermediate3)/5)+32);
s=test_final/100;
test_final=test_final%100;
lcd_cmd(0x88);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=test_final/10;
test_final=test_final%10;
lcd_data(s+48);
lcd_data(test_final+48);
lcd_data(0);
lcd_data(‘F’);
lcd_data(‘ ‘);test_final=test_intermediate3;
lcd_cmd(0xc1); //Setting cursor to first position of first line
delay(2);
lcd_data_string(“TEMP:”);
s=test_final/100;
test_final=test_final%100;
lcd_cmd(0xc8);
if(s!=0)
lcd_data(s+48);
else
lcd_cmd(0x06);
s=test_final/10;
test_final=test_final%10;
lcd_data(s+48);
lcd_data(test_final+48);
lcd_data(0);
lcd_data(‘c’);
lcd_data(‘ ‘);
delay(2);
}
unsigned char get_ack()
{
unsigned char header_found;
unsigned char i;
unsigned char recv_buffer[10],rec_char;unsigned char ack[7]=”nOKr”;
header_found=0;
while(1)
{
rec_char =read_scr();
if(rec_char==’n’ && header_found==1 )
{
break;
}
if(rec_char==’n’ && header_found==0)
{
header_found=1 ;
i=0;}
if(header_found==1)
{
recv_buffer=rec_char;
i++;
}
}
recv_buffer=’