CAMP ASSIGNMENT 4 SOLUTION
66>>Design an 8085 microprocessor based system working at 3 MHz having the
following interface:
1) 8 KB EPROM using 4KB chips
2) 16 KB RAM using 8KB chips
ANS---->
To design a microprocessor-based system with the given specifications, we will need the following components:
- 8085 microprocessor: The heart of the system, it will execute the program stored in the EPROM and access data from RAM.
- 8 KB EPROM: To store the program code, we will use four 4KB EPROM chips.
- 16 KB RAM: To store data during program execution, we will use two 8KB RAM chips.
- Address decoder: To select the appropriate memory chip based on the address signals from the microprocessor.
- Clock generator: To provide a clock signal to the microprocessor and other components.
The following is a high-level diagram of the system:
+-----------------------+ | | | 8085 MPU | | | +-----------+-----------+ | | +-------+-------+ | | | Address bus | | | +---------------+ | | +-----------+-----------+ | | | Address | | Decoder | | | +-----------+-----------+ | +----------------+---------------+ | | | | | | +---------+---------+ +---+---+ +--------+--------+ | | | | | | | 4KB EPROM | | | | 8KB RAM | | | | | | | +-------------------+ +-------+ +-----------------+
Here's how the components are connected:
- The 8085 microprocessor is connected to the address and data buses.
- The address bus is connected to the address decoder.
- The address decoder selects the appropriate memory chip based on the address signals from the microprocessor.
- The EPROM chips are connected to the data bus through the address decoder.
- The RAM chips are also connected to the data bus through the address decoder.
- The clock generator provides a clock signal to the microprocessor and other components.
To implement the EPROM and RAM chips, we will need to configure the address decoder to select the appropriate chip based on the address range. For example, we can use the address range 0000H-1FFFH for the EPROM and 2000H-3FFFH for the RAM.
We can also use chip enable signals to enable or disable each memory chip. For example, we can use the chip enable signal of the EPROM to enable or disable the EPROM chips based on the address range. Similarly, we can use the chip enable signal of the RAM to enable or disable the RAM chips based on the address range.
With these components and connections, we can design a microprocessor-based system with 8KB of EPROM and 16KB of RAM that runs at 3MHz.
67>>
A binary number is stored in memory location 2050H. Convert it into BCD
number and store BCD 1 (least significant BCD digit) into memory location
2051H and BCD 2 and BCD 3 in memory locations 2052H and 2053H.
(Binary to BCD conversio
ANS---->To convert a binary number into BCD format, we need to convert each 4-bit nibble of the binary number into its equivalent BCD digit. Here's how we can convert the binary number stored in memory location 2050H into BCD:
- Load the binary number from memory location 2050H into a register.
- Divide the register by 10 to obtain the least significant BCD digit. Store the remainder in memory location 2051H.
- Divide the register by 10 again to obtain the second least significant BCD digit. Store the remainder in memory location 2052H.
- Divide the register by 10 once more to obtain the most significant BCD digit. Store the remainder in memory location 2053H.
Here's the assembly code to perform this conversion:
; Load binary number from memory location 2050H into register A LDA 2050H MOV B, A ; Copy binary number to register B ; Divide by 10 to obtain least significant BCD digit MOV A, B ANI 0FH ; Clear upper nibble MOV C, A MOV A, B SUB C ; Divide by 10 MOV C, A MOV A, C ; Save least significant BCD digit to memory STA 2051H ; Divide by 10 to obtain second least significant BCD digit MOV A, B ANI 0FH ; Clear upper nibble MOV C, A MOV A, B SUB C ; Divide by 10 MOV C, A MOV A, C ; Save second least significant BCD digit to memory STA 2052H ; Divide by 10 to obtain most significant BCD digit MOV A, B ANI 0FH ; Clear upper nibble MOV C, A MOV A, B SUB C ; Divide by 10 MOV C, A MOV A, C ; Save most significant BCD digit to memory STA 2053H
After executing this code, the BCD equivalent of the binary number stored in memory location
68>>
An 8-bit number is stored in memory location 2050H. Write a program to
convert the number into ASCII Hexcode and save the result in memory
locations 2060H and 2061H
(Binary to ASCII conversion)
ANS---->To convert an 8-bit binary number into ASCII Hexcode, we need to convert each 4-bit nibble of the binary number into its equivalent ASCII character. Here's how we can convert the binary number stored in memory location 2050H into ASCII Hexcode:
- Load the binary number from memory location 2050H into a register.
- Mask the upper nibble of the register to get the value of the lower nibble.
- Convert the lower nibble to its ASCII Hexcode equivalent and store it in memory location 2060H.
- Shift the register right by 4 bits to get the value of the upper nibble.
- Convert the upper nibble to its ASCII Hexcode equivalent and store it in memory location 2061H.
Here's the assembly code to perform this conversion:
After executing this code, the ASCII Hexcode equivalent of the binary number stored in memory location 2050H will be stored in memory locations 2060H and 2061H. For example, if the binary number stored in memory location 2050H is 10101010, the ASCII Hexcode equivalent "AA" will be stored in memory locations 2060H and 2061H.
; Load binary number from memory location 2050H into register A LDA 2050H ; Convert lower nibble to ASCII Hexcode and store in memory location 2060H MOV B, A ANI 0FH ; Mask upper nibble CALL bin2hex STA 2060H ; Shift right by 4 bits to get upper nibble MOV A, B DAA ; Adjust for decimal arithmetic RRC ; Shift right by 4 bits ; Convert upper nibble to ASCII Hexcode and store in memory location 2061H CALL bin2hex STA 2061H HLT bin2hex: ; Convert binary digit in A to ASCII Hexcode and return result in A PUSH PSW ANI 0FH ADDI 30H JNC skip ADDI 07H skip: POP PSW RET
69>>
Write a program in ALP of 8085 to convert a 2-digit BCD number stored at
memory location 2050H into binary equivalent number and store the result
in memory location 2060H.
(BCD to Binary conversion)
ANS---->To convert a 2-digit BCD number stored in memory location 2050H into its binary equivalent and store the result in memory location 2060H, we can use the following algorithm:
- Load the BCD number from memory location 2050H into a register.
- Clear the high-order byte of the register.
- Convert the low-order BCD digit to its binary equivalent by masking the lower nibble and adding it to the register.
- Shift the register left by 4 bits.
- Convert the high-order BCD digit to its binary equivalent by masking the lower nibble and adding it to the register.
- Store the resulting binary number in memory location 2060H.
Here's the assembly code to perform this conversion:
LDA 2050H ; Load the BCD number from memory location 2050H MOV B, A ; Move the BCD number to register B ANI 0FH ; Mask the low-order BCD digit MOV A, B ; Move the BCD number back to register A ADD B ; Add the low-order binary digit to the register XCHG ; Swap the contents of the registers ANI 0FH ; Mask the high-order BCD digit MOV C, A ; Move the result to register C MOV A, B ADD C ; Add the high-order binary digit to the register MOV C, A ; Move the result back to register C SHLD 2060H ; Store the binary number in memory location 2060H HLT ; End of program
Comments
Post a Comment