Question

In: Electrical Engineering

Write a Pseudo Code to send an Array of 20 elements from 8051 to the computer...

Write a Pseudo Code to send an Array of 20 elements from 8051 to the computer via serial port at maximum baud rate possible with XTAL=11.0592MHz.

Solutions

Expert Solution

ORG 0

MOV P2, #0FFH   ; make P2 an input port

MOV TMOD,#20H   ;timer 1, mode 2

MOV TH1, #0FAH   ;4800 baud rate

MOV SCON, #50H   ; 8-bit, 1 stop, REN enabled

SETB TR1    ; start timer 1

MOV DPTR, #MYDATA ; load pointer for message

H_1: CLR    A       

MOV A,@A+DPTR   ;get the character

JZ      B_1    ;if last character get out

ACALL SEND   ;otherwise call transfer

INC    DPTR   ;next one

SJMP H_1    ;stay in loop B_1:

MOV a,P2    ;read data on P2

ACALL SEND   ;transfer it serially       

ACALL RECV               ;get the serial data     

MOV P1,A                  ;display it on LEDs     

SJMP B_1                  ;stay in loop indefinitely

---------serial data transfer. ACC has the data-------------  

SEND: MOV SBUF,A        ;load the data H_2:

JNB TI,H_2                   ;stay here until last bit gone

CLR TI    ; get ready for next char

RET     ;return to caller


Related Solutions

Write code that would allocate the space for an array of 20 integers. It will be...
Write code that would allocate the space for an array of 20 integers. It will be pointed to by a variable named "junk" Write code that puts “file did not open” into an error stream.
write the code that declares an array of booleans, called myarray, with size of 40 elements
write the code that declares an array of booleans, called myarray, with size of 40 elements
Write the pseudo code for this problem based on what you learned from the video. The...
Write the pseudo code for this problem based on what you learned from the video. The purpose is to design a modular program that asks the user to enter the length and width, and then calculates the area. The formula is as follows: Area = Width x Length
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 a pseudo code for an O (n7log3n) algorithm. Please write in C++.
Write a pseudo code for an O (n7log3n) algorithm. Please write in C++.
Write a pseudocode or java code implementation for linear search that searches elements based on a key value from an array of undetermined length
Write a pseudocode or java code implementation for linear search that searches elements based on a key value from an array of undetermined lengthJAVA
Write a code of digital alarm clock 8051 microcontroller using pin AT89S52
Write a code of digital alarm clock 8051 microcontroller using pin AT89S52
Question 2. The following code defines an array size that sums elements of the defined array...
Question 2. The following code defines an array size that sums elements of the defined array through the loop. Analyze the following code, and demonstrate the type of error if found? What we can do to make this code function correctly? #include <stdio.h> #define A 10 int main(int argc, char** argv) { int Total = 0; int numbers[A]; for (int i=0; i < A; i++) numbers[i] = i+1; int i =0; while (i<=A){    Total += numbers[i];    i++; }...
ASSIGNMENT: Write a program to reverse an array and then find the average of array elements....
ASSIGNMENT: Write a program to reverse an array and then find the average of array elements. Start by creating 2 arrays that can each hold 10 integer values. Then, get values from the user and populate the 1st array. Next, populate the 2nd array with the values from the 1st array in reverse order. Then, average the corresponding elements in the 1st and 2nd arrays to populate a 3rd array (average the 1st element of the 1st array with the...
A customer in a grocery store is purchasing three items. Write the pseudo code that will:...
A customer in a grocery store is purchasing three items. Write the pseudo code that will: • Ask the user to enter the name of the first item purchased. Then ask the user to enter the cost of the first item purchased. Make your program user friendly. If the user says the first item purchased is milk, then ask: “What is the cost of milk.” [This should work no matter what item is entered by the user. I might buy...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT