EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

race condition? between relays and 89C51 uC

Started by Mak September 17, 2011
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
On Sat, 17 Sep 2011 07:23:36 -0700 (PDT), Mak <mansoor.naseer@gmail.com>
wrote:

>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...
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
On 09/17/2011 04:23 PM, Mak wrote:

> 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...
Perhaps you're configuring the port direction as outputs, and then writing the port value as '1', instead of writing the port value first ?
On Sep 17, 3:23=A0pm, Mak <mansoor.nas...@gmail.com> wrote:
> 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
I think 8051 ports are high z at reset, try putting pull up resistors on the port.
On Sat, 17 Sep 2011 09:03:10 -0700, cbarn24050@aol.com wrote:

> On Sep 17, 3:23&nbsp;pm, Mak <mansoor.nas...@gmail.com> wrote: >> 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 > > I think 8051 ports are high z at reset, try putting pull up resistors on > the port.
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 www.wescottdesign.com
Mak wrote:
> 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
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 http://www.analogconsultants.com/
On Sep 18, 2:23=A0am, Mak <mansoor.nas...@gmail.com> wrote:
> Can someone please explain what areas I am over looking...
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 ? -jg
Am 17.09.2011 16:23, schrieb Mak:
> 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
Old 51-MCUs had different circuitry for port 0 and the other ports. cheers Gunther

The 2024 Embedded Online Conference