Search this site

I/O Port Programming - Unit 4 - Review Questions & Answers from 8051 Microcontrollers & Embedded Systems by Mazidi

SECTION 4.1: 8051 I/0 PROGRAMMING

1. There are a total of ports in the 8051 and each has bits.

2. True or false. All of the 8051 ports can be used for both input and output. 

3. Which 8051 ports need pull-up resistors to function as an I/0 port?

4. True or false. Upon power-up, the 1/0 pins are configured as output ports.

5. Show simple statements to send 99H to ports Pl and P2. 

Answers: 

1. 4, 8. 

2. True 

3. PO

4. False

5. MOV Pl,#99H 

    MOVP2,#99H


SECTION 4.2: 1/0 BIT MANIPULATION PROGRAMMING

1. True or false. The instruction "SETB P2. 1" makes pin P2.1 high while leaving other bits of P2 unchanged.

2. Show one way to toggle the pin Pl.7 continuously using 8051 instructions.

3. Using the instruction" JNB P2 . 5, HERE" assumes that bit P2.5 is an (input, output).

4. Write instructions to get the status of P2.7 and put it on P2.0. 

5. Write instructions to toggle both bits of Pl.7 and Pl.O continuously. 

Answers: 

1. True 

2. Hl: CPL Pl.7

    SJMP  Hl 

3. Input

4. MOV C,P2.7 

    MOV P2.0,C

5. Hl: CPL Pl.7 

    CPL  Pl.O

    SJMP  Hl 

No comments:

Post a Comment