This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

AT89S51 LEDs test question ..

hi

I am testing LEDs with AT89S51 P1 pins .

Could I just connect P1.0 and P1.1 pins by 2 LEDs , or should I connect all P1.x pins ?

Should I connect RST pin ? Could I just connect Vcc and GND pins ?

I set P1 = 0x02 but get both LEDs on , not only P1.1 LED , do you know what's wrong ?

Thank for your guiding .

  • Based on your questions, my counter-question: have you looked at any schematics containing your processor?

    Yes, you should connect the reset pin.

    How do you connect your LEDs? Note that the pins can sink quite a lot of current, but they can hardly source any current - that matters a lot when deciding how to connect the LEDs. Your code seem to indicate that you want to hold the I/O pins high to turn on a LED - that would require the processor to source current. Having the LED connected between VCC and an I/O pin would instead mean that driving the pin low would have the processor sink current.

    Of course, you also have to consider what series resistor to use, since the LED doesn't like 5V and will draw all current it can get until it have managed to force the supply down to the about 2V the LED operates at (note - different voltage depending on color of LED, so different resistor suitable depending on color).

  • hi

    Could I save RST and clock PINs connection ?

    I just want to test IO port and blink the LEDs.

    But not matter I add RST , or assign P0_1 P0_2 P0_3 P0_4 1 or 0 , P0 LEDs are always on.

    I wonder if I did not flash AT89S51 firmware correctly .

    Thank for you guiding .