Searching \ for 'Relays AGAIN! :(' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/motors.htm?key=relay
Search entire site for: 'Relays AGAIN! :('.

Truncated match.
PICList Thread
'Relays AGAIN! :('
1999\04\13@145956 by Jaume Aragay Badia

picon face
Hi everyone!
               It seems relays are on topic again. Here is my LATEST problem wi
th them:

I have to switch on two relays from two pic pins with 50 ms delay for the
second one relative to the first one; and later switch them both off with
70ms between the first and the second one. The switch off works fine, but
for the switch on both take some time to switch on 'ticking' for a second or
so as it was hard for them to switch but finally do, and the PIC doesn't
reset itself. If the 'on' lap between the relays is longer, no problem
occurs. Any suggestion for this 'fast' start?


Jaume.

----------------------
 Jaume Aragay Badia
  spam_OUTaragayTakeThisOuTspamemail.com
----------------------

1999\04\13@151757 by Andy Kunz

flavicon
face
>reset itself. If the 'on' lap between the relays is longer, no problem
>occurs. Any suggestion for this 'fast' start?

Have the PIC drive a transistor which can handle several times the current
required by the coil in the relay.  You might not be resetting the PIC, but
the relay might not have enough amps to flip to the new state reliably.
Often a large cap can be discharged through the windings to make this
happen quicker.

Do not update the pins directly.  Instead, update a "shadow" of the port,
then write the new value directly to the port.  This is standard practice
for reliable applications.

shadow_port     ds      1
#define relay_1 shadow_port,0
#define relay_2 shadow_port,1

...
       bsf     relay_1                 ; Turn on relay 1
       movf    shadow_port,w
       movwf   PORTB
       call    delay_50_mS             ; wait
       bsf     relay_2                 ; Do for relay 2
       movf    shadow_port,w
       movwf   PORTB
...

Andy

1999\04\13@203639 by erik

flavicon
face
Hello.
Could someone tell me the benifit to not writing to the Ports directly?

Erik



Andy Kunz wrote:
<Snip>

> Do not update the pins directly.  Instead, update a "shadow" of the port,
> then write the new value directly to the port.  This is standard practice
> for reliable applications.

1999\04\13@205603 by Tony Nixon

flavicon
picon face
erik wrote:
>
> Hello.
> Could someone tell me the benifit to not writing to the Ports directly?

You can write to the ports directly anytime.

The problem with writing to ports becomes a problem if you use
instructions like BSF etc, which do a 'read modify write' on the port
data.

Read - Reads the data from the port INPUT latch

Modify - Modifys the data according to the instruction

Write - Sends the modified data to the port OUTPUT latch.

This can change the values in the output latch AND/OR the actual port
pins depending on the TRIS setting. This may have undesireable effects.

--
Best regards

Tony

PicNPoke - Multimedia 16F84 Beginners PIC Tools.

http://www.picnpoke.com
Email .....picnpokeKILLspamspam@spam@cdi.com.au

1999\04\13@224919 by TrionicIan

picon face
> erik wrote:
>  >
>  > Hello.
>  > Could someone tell me the benifit to not writing to the Ports directly?
>
>  You can write to the ports directly anytime.
>
>  The problem with writing to ports becomes a problem if you use
>  instructions like BSF etc, which do a 'read modify write' on the port
>  data.

Additionally ...
If you have a shadow register you can (eg: under interrupt) regularly ensure
that the port is configured correctly (in/out) and store out the correct data
... then if some transient corrupts the port, it is corrected again soon
after, on the next interrupt (or main loop execution).

Ian C.

1999\04\14@080422 by Jaume Aragay Badia

picon face
Jaume.

----------------------
 Jaume Aragay Badia
  aragayspamKILLspamemail.com
----------------------

{Quote hidden}

1999\04\14@080832 by Jaume Aragay Badia

picon face
> Have the PIC drive a transistor which can handle several times the current
> required by the coil in the relay.  You might not be resetting
> the PIC, but
> the relay might not have enough amps to flip to the new state reliably.
> Often a large cap can be discharged through the windings to make this
> happen quicker.

The transistor is a bc337 rated 1A, and the relay coil is 44mA, 530mW. May
it be any kind of transient from the first relay start? I use a 1A,12V
transformer so the power should not be the problem.


> Do not update the pins directly.  Instead, update a "shadow" of the port,
> then write the new value directly to the port.  This is standard practice
> for reliable applications.

I'll do it from now on. :)



Jaume.

----------------------
 Jaume Aragay Badia
  aragayspamspam_OUTemail.com
----------------------

p.s. sorry for the empty message before!

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...