Friday, June 28, 2013

IC  of 8051 microcntroller are 40 pins with DIP(dual in package).32 pins of controller used as I/O pins to read and write data from peripheral device as well as to connect external device with microcontroller.there are four ports(P0,P1,P2 & P3) in micro controller.each ports contain 8pins within.each port work as I/O ports.upon reset configure all port work as input ports.

 PORT 0 (P0.0 TO P0.7).
  • Pin No :32 to 39.
  • work as input or output port.
  • also provide 8 bit data (AD0-AD7).
  • it also give lower byte of address (A0-A7) with PORT 2.
  • connect pull-up register with port 0 with it. 
  • to make this port as input we have to write 1 to all pins.for output write 0 to all pins of this port. 
PORT 1(P1.0 TO P1.7):
  • Pin No :1 to 8
  • it work as input or output.
  • its do not need to connect pull up register because internally connected pull up register.
  • port1 is by default input port to make it as output port write 0 to all pins of it. 
PORT 2(P2.0 TO P2.7):
  • Pin no:21 to 28.
  • Work as input or output port.
  • also provide higher byte of address (A8-A15) with port0.
PORT 3(P3.0 TO P3.7):
  • Pin no:10 to 17.
  • work as input or output.
  • also each pin have different function which shown in next table.


how to make any port as input/output port? 
port 0 as input port.
MOV P0,#0FFH

port0 as output port.
MOV P0,00H

1 comments:

Unknown said...

how to initiate port 3 as an input port ?

acutely there is push switch connecting to p3.2 and i need call function when the user pressed the push switch >>> not counter and not timer... just call a function ( do special thing) when push witch pressed

Related Posts Plugin for WordPress, Blogger...
Subscribe to RSS Feed Follow me on Twitter!