ibwev
Newbie level 5
- Joined
- May 12, 2013
- Messages
- 10
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Shreveport, LA
- Activity points
- 1,361
I wrote a program that blinks the LED on RA5 and closes the relay (component from existing circuit that I am trying to control, see pic) after SW 1 is closed and the pic conducts a series of test. After SW1 has been opened, the program counts a predetermined number of low cycles (negative part of sine wave from 24 VAC). Once the predetermined number of low cycles is reached, the LED is turned off. So the sequence of events is:
1) SW1 is closed
2) Pic conducts series of test and flashes the LED on RA5
3) If test passes, relay is turned on. (SW2 and SW3 are strictly for troubleshooting)
With SW2 opened and SW3 closed, I can cycle SW1 and the LED responds as expected. In other words, the LED blinks when SW1 is closed (input RB4 is high) and stops blinking when SW1 is opened (input RB4 is low). If I close SW1, SW2, and SW3 then the LED blinks as expected; however, when I open SW1 the LED continues to blink. PicKit2 Debugger confirmed that the pic thinks it is receiving a high signal on RB4 with SW1 opened after SW1 has been cycled. The LED will turn off after SW1 has been cycled if I cycle SW2 –OR- if I cycle SW3 . Please help me understand why I must cycle SW2 or SW3 after SW1 has been cycled to turn off the LED.
1) SW1 is closed
2) Pic conducts series of test and flashes the LED on RA5
3) If test passes, relay is turned on. (SW2 and SW3 are strictly for troubleshooting)
With SW2 opened and SW3 closed, I can cycle SW1 and the LED responds as expected. In other words, the LED blinks when SW1 is closed (input RB4 is high) and stops blinking when SW1 is opened (input RB4 is low). If I close SW1, SW2, and SW3 then the LED blinks as expected; however, when I open SW1 the LED continues to blink. PicKit2 Debugger confirmed that the pic thinks it is receiving a high signal on RB4 with SW1 opened after SW1 has been cycled. The LED will turn off after SW1 has been cycled if I cycle SW2 –OR- if I cycle SW3 . Please help me understand why I must cycle SW2 or SW3 after SW1 has been cycled to turn off the LED.
Last edited: