Other

What are the input and output ports used in 8051 microcontroller?

What are the input and output ports used in 8051 microcontroller?

8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input or output. Hence, total 32 input/output pins allow the microcontroller to be connected with the peripheral devices. Pin configuration, i.e. the pin can be configured as 1 for input and 0 for output as per the logic state.

What are the ports available in 8051 microcontroller?

The 8051 has four important ports. Port 0, Port 1, Port 2 and Port 3. These ports allow the microcontroller to connect with the outside world.

What are the uses of port 0 and port 2 of 8051?

When connecting an 8051/31 to an external memory, port 0 provides both address and data. Port 1 is used as input and output. Upon reset, port 1 is configured as an input port. Port 2 is also used as input or output.

What are the 4 ports of 8051?

2. Which out of the four ports of 8051 needs a pull-up resistor for using it is as an input or an output port? Explanation: These pins are the open drain pins of the controller which means it needs a pull-up resistor for using it as an input or an output ports.

How are I / O ports used in an 8051 microcontroller?

In this example I will explain how to use I/O ports of 8051 microcontroller. Input to the microcontroller can be given through push button and output can be seen through LED. Firstly all the port pins are defined. Port 2 is used as output port and port 3 is used as input port.

How to do input output programming in 8051?

The code above first places 01010101 [binary] into Port 1. Then the instruction “XRL P1,#0FFH” performs an XOR logic operation on Port 1 with 1111 1111 [Binary], and then writes the result back into Port 1. XOR of 55H and FFH gives AAH, and the XOR of AAH and FFH gives 55H.

Which is the true bidirectional port of 8051?

Port-1, 2, 3 are called ‘quasi bidirectional port’. Port-0 Pin Structure Port -0 has 8 pins (P0.0-P0.7). Each port of 8051 has bidirectional capability. Port 0 is called ‘true bidirectional port’ as it floats (tristated) when configured as input. Port-1, 2, 3 are called ‘quasi bidirectional port’.

How does Tris Register work in 8051 microcontroller?

In pic microcontroller TRIS register determines whether port would act as input or output and PORT register would determine the content, what should be written (in case of output) or read (in case of input). But in 8051 there isn’t any such kind of TRIS register.