Question

In: Physics

Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room...

Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room temperature on 16x2 LCD (10marks)

please note that the program should be interfacing with ADC0804.

Solutions

Expert Solution

So the assembly language program for interfacing of ADC0804 and LM35 to display the room temperature on 16x2 LCD is

#include<reg51.h>

#define lcd P0
#define dat P3
sbit rs=P2^0;
sbit e=P2^1;


void delay (int);
void display (unsigned char);
void cmd (unsigned char);
void init (void);
void string (char *);
void intro (void);
unsigned char degree[8]={0x0e,0x0a,0x0e,0x00,0x00,0x00,0x00,0x00};
char i=0;

void delay (int d)
{
   unsigned char i=0;
   for(;d>0;d--)
   {
       for(i=250;i>0;i--);
       for(i=248;i>0;i--);
   }
}
void cmd (unsigned char c)
{
   lcd=c;
   rs=0;
   e=1;
   delay(10);
   e=0;
}
void display (unsigned char c)
{
   lcd=c;
   rs=1;
   e=1;
   delay(10);
   e=0;
}
void string (char *c)
{
   while(*c)
   {
       display(*c++);
   }
}
void init (void)
{
   cmd(0x38);
   cmd(0x01);
cmd(0x0c);
   cmd(0x80);
}
void intro (void)
{
   string(" Electronics ");
   cmd(0xc0);
   string(" Hub ");
   delay(1000);
   cmd(0x01);
   string(" Digital ");
   cmd(0xc0);
   string(" Thermometer ");
   delay(1000);
   cmd(0x01);
       cmd(0x40);
       for(i=0;i<8;i++)
       display(degree[i]);
   i=0;
   cmd(0x80);
}

void main()
{
   unsigned int val=0;
   unsigned int temp=0;
   init();
   intro();
   dat=0xff;
   while(1)
   {
       if(i==0)
       {
           string("Temp: ");
           i++;
       }
       val=dat*1.953;
       cmd(0x86);
      
      
       temp=(((val/10)%10)+48);
       display(temp);
      
       temp=((val%10)+48);
       display(temp);
if(i==1)
       {
       display(0);
       string("C");
           i++;
       }
       delay(300);
   }
   while(1);
}


Related Solutions

write a assembly language program to convert GRAY to BCD code in 8051
write a assembly language program to convert GRAY to BCD code in 8051
Write an assembly language program for 8051 microcontroller to find the sum of the following series,...
Write an assembly language program for 8051 microcontroller to find the sum of the following series, 1, -2, +3, -4, +5, -6,..., up to 100 terms. Store lower byte in R0 and higher byte in R1.
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE...
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO SOLVE THE EQUATION Z=A+B-(C/D)+E please write the answer separately part A its own code and part B its own code this is microprocessor the ASSEMBLY LANGUAGE emu8086 should be written like this EX: mov ax,100h mov bx,200h etc
In MIPS assembly language, write a function that will display the max and min value in...
In MIPS assembly language, write a function that will display the max and min value in an array. Then write a function to calculate and display the average of all values in an array. This must be done in MIPS assembly language.
Write a program in MIPS assembly language to perform the calculation of the following equation and...
Write a program in MIPS assembly language to perform the calculation of the following equation and save the result accordingly:    f = 5x + 3y + z Assumptions: - Registers can be used to represent variables x, y, z, and f - Initialize x, y, and z to values of your choice. f can be initialized to zero. - Use comments to specify your register usage and explain your logic
ASSEMBLY LANGUAGE ONLY OR I WILL DOWNVOTE write a program that will allow a person to...
ASSEMBLY LANGUAGE ONLY OR I WILL DOWNVOTE write a program that will allow a person to play a Guess a C♠rd Game. This section specifies the required functionality of the program. The interface must be a BlueJ Terminal Window, otherwise zero marks will be awarded. Only a simple screen presentation of the game is required; however, more marks will be gained for a game that is easy to follow with clear informative messages to the player. The aim of the...
**IN AT&T ASSEMBLY LANG** Write an assembly language program which either hardcodes or reads in two...
**IN AT&T ASSEMBLY LANG** Write an assembly language program which either hardcodes or reads in two integers, A and B, and uses them to compute the following expressions. You must use the same values for A and B throughout all three expressions. A * 5 (A + B) - (A / B) (A - B) + (A * B)
Write an assembly language program that will print out the message of your choosing #NOTE #write...
Write an assembly language program that will print out the message of your choosing #NOTE #write in a simple way, so that i can execute it from command window using masm
Write an assembly language program that corresponds to the following C program ****Please give correct answer...
Write an assembly language program that corresponds to the following C program ****Please give correct answer using Pep/9 machine**** int num1; int num2; ;int main () { scanf("%d", &num1); num2 = -num1; printf("num1 = %d\n", num1); printf("num2 = %d\n", num2); return 0; }
Write a mips assembly language program. Ask the user whether he wants to repeat the program:...
Write a mips assembly language program. Ask the user whether he wants to repeat the program: "\nRepeat [y/n]? ". Use service code 12 to read a character and the branch instruction to repeat the main function if the user input is character 'y'.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT