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

Initializing Port 0 and Port 2 with 0x00 value

The hardware that I am working on has Relays connected on Port 0 and Port 2 pins of AT89S52 uc. I would like to know if it is possible to initialize the port pins with 0x00 values before the main application starts. I tried doing this:

P0 = P2 = 0xFF;
P0 = P2 = 0x00;

but in this case the relay stops to respond. The uc does not communicate after doing this.

Please advice.

Parents
  • "24 DPDT relays connected via 74HCT541..."

    "The port pins are all high (1) on power on. In this state all the relays are energized. I need them all to be low (0), so that i can switch on the relays that i want."

    The hc541's have two gates that will tri-state the outputs. So you connect a pin to one of the two gates and pull it down when you are ready to output data to the relay.

    Alternatively, you can use a rc network to pull down the gates. In that case, you will need to reset the mcu's output before the output is enabled.

Reply
  • "24 DPDT relays connected via 74HCT541..."

    "The port pins are all high (1) on power on. In this state all the relays are energized. I need them all to be low (0), so that i can switch on the relays that i want."

    The hc541's have two gates that will tri-state the outputs. So you connect a pin to one of the two gates and pull it down when you are ready to output data to the relay.

    Alternatively, you can use a rc network to pull down the gates. In that case, you will need to reset the mcu's output before the output is enabled.

Children
No data