Hello there!
First of all I want to state that I am an absolute beginner in programming.
I am quite experienced in electronics (audio mostly) though, but I never dipped my toes in programming since recently...
So, I am trying to implement a PIC microcontroller (PIC 16F676) in one of my designs. Its use will be to drive some relays by taking digital information by a few switches.
I have already programmed a working code with the XC8 compiler for a couple of non-latching relays that are in my design... But there is a dual coil latching relay also in the circuit, and here is the problem.
This latching relay must be controlled by a SPST ON-OFF switch (Latching... NOT momentary).
I have tried triggering a pulse out of the microcontroller when it reads high or low from the switch but with no good results.
My main problem (I think...) is that since I there is a latching switch, the pulse for the latching relay must be sent only when the PIC sees a change at its input pin... and do this just once, somehow... ( I mean not doing it repeatedly while it sees the desired input since there is a latching switch in the input). Of course since it is a dual coil relay there will be two outputs from the PIC to drive the two coils (with a 5V pulse using transistors)...
I am posting this because I honestly don't know where to start addressing my problem, so any help will be appreciated, even to give me a general approach I should be taking.
P.S. (I am not sure if this thread should be here or in the micro-controllers section forum... lets move it if it is more relevant there)
First of all I want to state that I am an absolute beginner in programming.
I am quite experienced in electronics (audio mostly) though, but I never dipped my toes in programming since recently...
So, I am trying to implement a PIC microcontroller (PIC 16F676) in one of my designs. Its use will be to drive some relays by taking digital information by a few switches.
I have already programmed a working code with the XC8 compiler for a couple of non-latching relays that are in my design... But there is a dual coil latching relay also in the circuit, and here is the problem.
This latching relay must be controlled by a SPST ON-OFF switch (Latching... NOT momentary).
I have tried triggering a pulse out of the microcontroller when it reads high or low from the switch but with no good results.
My main problem (I think...) is that since I there is a latching switch, the pulse for the latching relay must be sent only when the PIC sees a change at its input pin... and do this just once, somehow... ( I mean not doing it repeatedly while it sees the desired input since there is a latching switch in the input). Of course since it is a dual coil relay there will be two outputs from the PIC to drive the two coils (with a 5V pulse using transistors)...
I am posting this because I honestly don't know where to start addressing my problem, so any help will be appreciated, even to give me a general approach I should be taking.
P.S. (I am not sure if this thread should be here or in the micro-controllers section forum... lets move it if it is more relevant there)