• AVR Freaks

Hot!Dimmer bouncing whenever any remote button pressed

Page: < 123 Showing page 3 of 3
Author
dan1138
Super Member
  • Total Posts : 3232
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 12:20:38 (permalink)
+2 (2)
akibsk
so, where is the issue please what should i need to stop the boumce please once go thru my code please sir?????

Your issues are a direct result of failing to fully describe what tasks your Infrared receiver must perform. What description you have provided show only a limited understand  of the functionality needed to implement the behavior required.

So my questions to you are:
Do you want to really learn how to do hardware and firmware design?

Or do you just want someone to create working hardware and firmware for you?

For myself I would help you towards either goal.
#41
akibsk
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2018/10/30 07:07:04
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 12:58:32 (permalink)
0
tnx,
""Do you want to really learn how to do hardware and firmware design?""
obviously yes sir,
as i have told that i do not have such knowledge, i am trying still now.
please advice..
tnx..
 
#42
qhb
Superb Member
  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 13:41:13 (permalink)
+3 (3)
akibsk
...
please advice..

Then actually read the responses you are getting. They are telling you what s wrong with your code, but you keep ignoring them.

Nearly there...
#43
akibsk
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2018/10/30 07:07:04
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 13:58:41 (permalink)
0
tnx for reply sir.
if i would have find whats wrong in my code then i could have solved the problems what i am facing which i trying to repeatedly said. i have given all the detailed incl. code with comment, schematics and flowchart etc. 
however i think due to my poor knowledge there may be arising some communication gap and completely able to make them understand.
i still here because i want to learn from you specially  kksir.
tnx kk sir.
thx for your kind advice.
#44
qhb
Superb Member
  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 14:29:33 (permalink)
+1 (1)
Let's get back to basics.
How much of this code did you write?
How much is written by someone else?
You seem to have very little understanding of your own code.
 

Nearly there...
#45
akibsk
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2018/10/30 07:07:04
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 14:53:34 (permalink)
0
Trying to write and understand . This is second .
Tnx
#46
qhb
Superb Member
  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 15:32:16 (permalink)
+1 (1)
That did not answer any of my questions.
 

Nearly there...
#47
PStechPaul
Super Member
  • Total Posts : 2403
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 16:05:43 (permalink)
+1 (1)
I think the proper way to effect phase angle modulation is to start a timer at the zero crossing (INT0) and then have that timer trigger another interrupt where its ISR produces the pulse to fire the TRIAC at the desired phase delay. A delay of a few uSecs in the ISR to form the trigger pulse is OK. There are problems with the hardware for ZCD as I pointed out, and are easily fixed. And I would suggest using the __delay_us and __delay_ms macros included in XC8.
 
As presently coded, the ISR for INT0 has a blocking delay which may eat up so much time that the IR signal parsing might not work properly, so disabling INT0IE when an IR signal is detected might be necessary. But using the method I suggest above would allow the TRIAC trigger to continue until the command has been parsed and the new delay has been determined.
 
I'd like to help the OP with this, but he must first act on the advice offered and show revised code with comments that will help with understanding the logic flow.

 
#48
PStechPaul
Super Member
  • Total Posts : 2403
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 17:00:29 (permalink)
+1 (1)
The flow chart is incorrect:

 
The firing of the TRIAC should be in a separate loop, as it is an ISR and essentially a concurrent, parallel process. The main loop should run idle until a signal is detected from the IR input. Then the command parsing is done, and if it is a valid code, the corresponding functions should be executed. You show tight loops where the logic flow should go forward and then loop back where you show "sleep mode".

 
#49
dan1138
Super Member
  • Total Posts : 3232
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/02 18:26:49 (permalink)
+2 (2)
akibsk
dan1138
Do you want to really learn how to do hardware and firmware design?

obviously yes sir,
as i have told that i do not have such knowledge, i am trying still now.
please advice..

Your replies so far suggest that you lack the knowledge to understand the questions others have posted in this thread.

To learn how to do a design the first thing to understand is how to describe each and every step of the behavior needed.

It is clear to me from the code, schematic and flowchart you have posted that only the larger parts have any description. The parts that are more difficult to visualize and describe clearly are not included. This is typical of developers new to embedded design.

To use your project as an example these are the things that require description:
  1. How and when the TRIAC is triggered to control brightness.
  2. How the edges of the data stream from the IR receiver are detected and the data stream is assembled in bytes then validated.
  3. How the received bytes are decoded as commands.
  4. How the commands change the state of relays and TRIAC brightness.
These things all need complete descriptions. Without such documentation any code created will function badly if at all and be very hard to fix. But you know this already.
post edited by dan1138 - 2018/11/02 18:53:06
#50
akibsk
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2018/10/30 07:07:04
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/03 05:36:49 (permalink)
0
pAUL SIR,
as advice paul sir the corrected code and description is here. due to complexity the relay output has turncated from this code. only inc/dec botton is there. the output of hardware operation what observed  is also written as command.
 
tnx
 
#51
dan1138
Super Member
  • Total Posts : 3232
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/03 11:20:46 (permalink)
+2 (2)
@akibsk,

From reading the code you have posted you seem to lack any understanding how a TRIAC works and how to use it to control the brightness of an incandescent light.

The Wikipedia article about the TRIAC is one place to start.

Another is PIC DCV Controlled AC Light Dimmer blog post.

The Internet has many resources regarding TRIAC devices like application notes: Teccor AN1003.

I found these links from about 20 minutes of searching with Google. Yes I know there are a lot of search results that will be of no help to you, but try looking. Being new to this nobody expects you to stand tall but you do have to stand up.
#52
PStechPaul
Super Member
  • Total Posts : 2403
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: Dimmer bouncing whenever any remote button pressed 2018/11/03 17:50:25 (permalink)
+1 (1)
Your ISR is messed up, and you are still using PORTBbits.RB1 where you should use LATBbits.LATB1 for the TRIAC gate trigger. The __delay_ms(50) will cause the ISR to get hung up for 2.5 cycles. You should use __delay_us(50).
 
void interrupt isr()
{
    if(INT0IF)
    {
        
        //INT0IF=0;    //tested with set it but no changes
        delay(speed);       //if speed =5 then delay will be 2*5=10 msec output RB1(triac) should be turned off/
                            //and for speed=0 then 0 msec delay will glow in full brightness
        PORTBbits.RB1=1;   //tric=1;
        __delay_ms(50);   // no improve by using it instead of below for loop.
        //for(int t=0;t<50;t++);
        PORTBbits.RB1=0;   //tric=0;
        INT0IF=0;
    }
    
   if(TMR0IF)  //Check if it is TMR0 Overflow ISR   
   {
      TMR0IF=0;
   }
   // TMR0IF also removed but not improve.
   
}

 
I would suggest that you make a simple test program that just runs the ISR to dim the lamp at each of the "speed" settings. And you might want to make the delay function like this:
//DELAY LOOP FOR TRIAC TRIGGERING PULSE
void delay(int time)  // time in milliseconds. 0 will trigger TRIAC at ZC, 9 will give minimum brightness (10 might skip one half-cycle and trigger next one.
{
    for(int i=0;i<time;i++)
    __delay_ms(1);
}

 
You could try a sequence of dimmer values by making a loop in main():
while(1) {
  for(i=0; i<=10; i++) {
    time = i;
    __delay_ms(1000); }
  }

 
That will set the brightness to values of 0 to 10 with 1 second for each. Once you have that working, you can play with the command parser. But don't disable the INT0 interrupt unless you want to turn the lamp off.

 
#53
Page: < 123 Showing page 3 of 3
Jump to:
© 2019 APG vNext Commercial Version 4.5