|
|
View previous topic :: View next topic |
Author |
Message |
td
Joined: 16 Apr 2015 Posts: 21 Location: India
|
led blinking issue |
Posted: Mon Feb 01, 2016 4:50 am |
|
|
hi,
In our project, we have 2 set point values (example, 5 and 10 ). When one set point crosses, one led starts blink continuously. When 2nd crosses, 2nd led will start blinking.
We used timer interrupt for leds blinking. Timer0 for led1 and timer1 for led2.
When we press one switch (sw1), led become stable. And when the reading comes below the set points and press another switch (sw2), led will be off.
Code: |
#int_RTCC
void RTCC_isr(void)
{
output_toggle(RL2);
//output_low(RL1);
delay_us(1);
output_high(CLK);
delay_us(1);
output_low(CLK);
delay_us(1);
}
#int_TIMER1
void TIMER1_isr(void)
{
output_toggle(RL1);
//output_low(RL2);
delay_us(1);
output_high(CLK);
delay_us(1);
output_low(CLK);
delay_us(1);
}
|
According to the code written, when the reading is above 10, both leds should blink continuously. Sometimes both will ON and OFF same time. But when the reading goes below points and again goes above 10, both leds will blink at different times. Ie, when led1 is on, led 2will be off. When led1 is off, led2 on. Like that blink continuously.
According to the code written the above thing is fine. But we need both leds blink at same time when cross the reading 2. And when comes down also, until press sw2.
What changes I have to do for that ?
Please guide me. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Feb 01, 2016 6:12 am |
|
|
You need to show us your complete PIC program not jst parts of it
Also which PIC and what compiler version
Also most important is this real wharware or a simulator,very ,very important to know this!
Jay |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|