Starting from:

$34.99

Microprocessors Exercise Problems I Solution

LEDs & 7-Segment Display
Design the hardware interface and write an 8086-assembly program for the following projects. The addresses of ports A, B and C of the 8255A PIA are 01 H, 05 H, 09 H and 0D H respectively odd addresses. Assume that the forward voltage of a LED (VD) is 3V, and the required LED current (ID) is 8 mA.

1. The assembly program controls 16 LEDs according to the status of two switches (SW1 and SW2) connected to PORT C (PC0 and PC1). The LEDs are connected to PORT A and PORT B. The program controls the LEDs as follows: o If only SW1 is pressed, the program flashes the 8 LEDs connected to PORT A (5 times).
o If only SW2 is pressed, the program flashes the 8 LEDs connected to PORT B (5 times).
o If both SW1 and SW2 are pressed, the program flashes all the 16 LEDs connected to PORT A and PORT B (5 times).
o If both SW1 and SW2 are released, the program turns all the 16 LEDs OFF.
2. The assembly program monitors the status of a switch connected to PC7, and displays the number of switch presses on a seven-segment connected to PORT A. If the number exceeds 9, the program displays the letter F on the sevensegment.
3. The program controls 8 LEDs connected to PORT A as follows:
o First, turn ON the LED connected to PA7 (alone).
o Second, turn ON the LED connected to PA6, while keeping the PA7-LED ON. o Repeat the previous steps, by turning ON the LED that follows them, and so on until all the LEDs are turned ON.
o Do the same as the previous steps, but in reverse so that the LEDs are turned off sequentially, and continue until we return to the status of the LEDs that described in the first step. o Repeat all the previous steps.
4. The assembly program monitors the status of a switch connected to PC4.
o If the switch is pressed, the program rotates 8 LEDs connected to PORTA in a clockwise manner.
o If the switch is released, the rotation will occur in the opposite direction.
5. The program monitors the status of a switch connected to PORTC, and controls a seven-segment display connected to PORT A as follows:
o If the switch is pressed, the program displays the EVEN numbers on the sevensegment (in ascending order from 0 to 8 and repeat). o If the switch is released, the program displays the ODD numbers on the sevensegment (in descending order from 9 to 1 and repeats).
6. The program displays numbers from 0 to 9 on a seven-segment display connected to PORT B, and repeats. Each number displayed on the sevensegment is blinked twice before the next number is displayed.
7. The program monitors the status of a switch connected to PORTC, and controls a seven-segment display connected to PORT A as follows:
o If the switch is pressed, the program rotates only one segment of the 7segment in a clockwise direction (and repeats).
o If the switch is released, the program rotates only one segment of the 7segment in an anticlockwise direction (and repeats).
8. The program monitors the status of 8 switches, and displays the status of these switches on 8 LEDs connected to PORT C. The switches are connected to PORT A (PA0 to PA3) and PORT B (PB0 to PB3). The program displays the status of the 8 switches at the same time on the LEDs that are connected to PORTC.
9. Design the hardware interface and write an 8086-assembly language program for the following project:
▪ Two 8255A interfacing chips (Chip 1 & Chip 2) are connected to the 8086 microprocessor.
▪ The required port addresses are as follows:
Chip 1 addresses: PB1 02 H , PControl1 06 H
Chip 2 addresses: PB2 0A H , PControl2 0E H .
▪ The assembly program first flashes 8 LEDs connected to PB1 (10 times), then it displays even numbers (from 0 to 9) on a seven segment connected to PB2, then the program stops.
▪ Use two current limiting resistors and find their values, assuming that the LED forward voltage VD = 2.5 V, and the required LED current ID = 8 mA.
▪ Use one second delay intervals.
10. For the project described above, it is required to connect one of the 8255A interfacing chips to the high byte of the data bus [AD15 . . AD8]. Assume that the required port addresses are as follows:
Chip 1 addresses: PB1 02 H , PControl1 06 H
Chip 2 addresses: PB2 09 H , PControl2 0F H .
11. Design the hardware interface and write an 8086-assembly program for a common anode 7-segment display connected to PORT B. The program displays the letters A , E , F , H , L , and P (and repeat) if a switch connected to BIT0 of PORT A is pressed. If the switch is released, the program displays dash “ – ” on the 7-segment. Use two seconds delay intervals between each two characters.

More products