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.
Hi this is Assembly Language MASM x86 program. Please write it in the language and please...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please explain it with comments thank you Please answer it I really need help this question was refunded before so please answer. Thank you so much also these are two separate programs thank you. 1) Write a procedure to read in decimal or hex number (byte-sized) Then write a procedure using shifts and ANDS to convert the string to a binary number (if is backward,...
Using the windows 32 framework , write an assembly language program ; write a procedure to...
Using the windows 32 framework , write an assembly language program ; write a procedure to read a string and shift each character of the string by one. As an example, if your input string is Abcz, your output should be Bcda. Note that you must test your string for non-alphabetic characters (such as numbers and special characters). If there are non-alphabetic characters, you should terminate your program with an appropriate message. You should display your converted string using the...
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...
Write a program in assembly language that outputs the leap years between a beginning and an...
Write a program in assembly language that outputs the leap years between a beginning and an ending year. 1. Initialize $a0 and $a1 with the beginning and ending years. 2. Print out the leap years between 1970 and 2030. OUTPUT: From 1970 to 2030: 1972 … 2028
**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)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT