Led interfacing with 8051 microcontroller
8051 microcontroller is a 40 pin IC . it has 4 programmable port. each port has 8 pin so it has total 32 programmable pin which can use as input or output. it is a 8 bit IC so each resister and ALU size is 8 bit.
it can program port wise or pin wise both. it has 4 port named P0, P1,P2,and P3. each port has 8 pin
named --
P0.0 , P0.1,P0.2, P0.3, P0.4, P0.5, ,P0.6, P0.7.
P1.0, P1.1.................P1.7.
P2. 0.........................P2.7
P3.0............................P3.7
8051 Microcontroller |
in this m.c . P1,P2,and P3 is internally pull up(all pin have 1) .and P0 is neither pull up( 1 ) nor pull down( 0 ) .so all the port initially act as input.
if we want to connect a Led with a m.c. 2 case is possible.
case 1.
joint led at port P0.
case 2.
joint led at port P1,P2,or P3.
In case 1 , a external resistance is necessary for pull up
IN initial both side on led have equal voltage . when pin P0.0 is low led glow because voltage across led is approx 3 v. when voltage on pin P0.0 is high led will be off.
220 ohm resistance drop 2 v voltage and give 3 v.
in case 2 -
in this case no need to external pull up resistance . port pin have initially high voltage label . because it is internally pull high. so if led connect on Port 1,2,or 3 this type of connection is right.
if pin P2.0 is low led will glow.otherwise led remain off.
No comments:
Post a Comment