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 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 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
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...
Write a recursive algorithm in pseudo-code to compute the “power list” of a given list of...
Write a recursive algorithm in pseudo-code to compute the “power list” of a given list of integers. Assume that the List type has members: int List.length returns the length of the list. void List.push(T n) pushes an element n to the front of the list T List.pop() pops an element from the front of the list. List$$ List$$.concat(List$$ other) returns the concatenation of this list with other. Explain in plain English the reasoning behind your algorithm. Power Lists should be...
The following code was meant to print out the elements in an array in reverse order....
The following code was meant to print out the elements in an array in reverse order. However, it does not behave correctly. public static void reverse(int[] a, int index) {       if (index == (a.length - 1))         System.out.printf("%d%n", a[index]);       else {         reverse(a, index); What does it do? Explain why it behaves in this way and There is more than one error in the code. Correct the code so that it will recursively print out the elements of...
.data A: .space 80 # create integer array with 20 elements ( A[20] ) size_prompt: .asciiz...
.data A: .space 80 # create integer array with 20 elements ( A[20] ) size_prompt: .asciiz "Enter array size [between 1 and 20]: " array_prompt: .asciiz "A[" sorted_array_prompt: .asciiz "Sorted A[" close_bracket: .asciiz "] = " search_prompt: .asciiz "Enter search value: " not_found: .asciiz " not in sorted A" newline: .asciiz "\n" .text main: # ---------------------------------------------------------------------------------- # Do not modify la $s0, A # store address of array A in $s0 add $s1, $0, $0 # create variable "size" ($s1)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT