??? 01/11/07 13:42 Modified: 01/11/07 13:43 Read: times |
#130635 - The answer is... Responding to: ???'s previous message |
Hazman said:
as example, i want to light up an LED at port0, what should i do, i'm also facing same problem with p1.0, is there any register value to be modified first before i can use it as output port. The answer is, that a standard port pin like P1.0 is much too weak to directly drive heavy loads. A look into the DC characteristics of datasheet shows, that at IOH=-60µA output current output voltage can fall down to 2.4V. So, there's no enough power to directly drive a LED. But when you turn-on the LED by emitting low state, then datasheet tells, that several milliamperes can be sinked. So, connect the anode of your LED to Vcc, the cathode to a current limiting resistor of 680Ohm and finally the other end of this resistor to the P1.0 pin. Then, whenever the output goes low, means whenever you write a "0" into the according SFR (special function register), the LED turns-on. You can do the same with P0.0 by the way. Read also this post, to see, how the special pull-ups of 89C52 work http://www.8052.com/forum/read.phtml?id=117921 Kai |