race condition? between relays and 89C51 uC

hello everyone,

I have a RS485 based slave relay driver with 8 relays. The relays turn on at logic 0. Since the 89C51 has all ports as HIGH during reset, my relays should remain off. The problem that I am facing is that when I turn the power supply on, all the relays turn on momentarily and then back off. Is there a race condition during which the microcontroller is not gaining control of the relay command lines even though I have the 89C51 in reset since start? The reset is standard 10uF + 10k resistor to the ground, should I be focusing on changing those? I cant seem to find any other reason that would trigger the relays.

Can someone please explain what areas I am over looking...

Thanks in advance

Reply to
Loading thread data ...

The 89C51 is on the slave relay board? And this board is a commercial product that is supposed to hold the relays in the un-powered state until commanded otherwise over the 485 line?

Got a schematic?

Scope the power supply, the reset line, the individual output bits, and the voltage across the relay coils.

Rich Webb     Norfolk, VA
Reply to
Rich Webb

Perhaps you're configuring the port direction as outputs, and then writing the port value as '1', instead of writing the port value first ?

Reply to
Arlet Ottens

I think 8051 ports are high z at reset, try putting pull up resistors on the port.

Reply to

That's what I was thinking. If you have an oscilloscope try capturing the turn-on transient to know for sure.

Tim Wescott
Control system and signal processing consulting
 Click to see the full signature
Reply to

Can you post a schematic? Else it'll be stabs in the dark. Ok, I'll take one: Could it be that the supply voltage for the relay driver comes up before the supply voltage for the 89C51 does?

As Rich and Tim suggested, the quickest way to find out what's going on is a digital scope. Can be a very simple one.

Regards, Joerg

Reply to

As others have said, use a scope to check. Also note that not all 89C51 variants have Async-Reset on the port pins; Many require the oscillator to be running, and that start-up time can give pin uncertainty. Which exact 89C51 variant are you using ?


Reply to
Jim Granville

Am 17.09.2011 16:23, schrieb Mak:

Old 51-MCUs had different circuitry for port 0 and the other ports.

cheers Gunther

Reply to
Gunther Mannigel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.