Dimmer - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 68 of 68

Thread: Dimmer

  1. #41
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi Steve,

    As you well know, it took about a month for me to figure out that this line does not work:

    @ device intrc_osc_noclkout, wdt_on, mclr_off, protect_off

    It should be either like
    @ device pic12F675, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
    or
    like

    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
    @ DEVICE pic12F675, WDT_ON
    @ DEVICE pic12F675, PWRT_ON
    @ DEVICE pic12F675, MCLR_OFF
    @ DEVICE pic12F675, BOD_ON
    @ DEVICE pic12F675, CPD_OFF
    @ DEVICE pic12F675, PROTECT_OFF
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  2. #42
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Smile Much better!

    Thanks guys! I knew I would be embarrased by the solution and I was right!

    OK, Now I have made the circuit change and have made the switch changes. I get the 5V outputs on pins GPIO.0 and .1 which go low when I press the up or down buttons. I do not, however, get any output from GPIO.2 which is the triac trigger. My guess is that the problem lies in the ACDetect routine. I see in previous posts that there were many references to this routine and it went through several revisions. Can someone verify that I have the correct routine?

    I have attached the code as a text file and the circuit design as a pdf. Would appreciate comments.

    Thanks again! Atom058
    Attached Images Attached Images
    Attached Files Attached Files

  3. #43
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Wink Stumped?

    Hello again - Did I stump everyone? Surely someone has a comment...

    Would really like to get this working!

    Thanks in advance! Atom058

  4. #44
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You have the right version.

    It's suppose to work unless you have some hardware issue OR device prograemmer issue.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #45
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    Mister-e - Thanks! I will go over my circuit again. It helps knowing that the code I am trying to run is the correct version - I can focus my attention elsewhere. If you (or anyone else) can offer some troubleshooting ideas, they would be appreciated.

    Atom058

  6. #46
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Thumbs up Making Progress!

    Well, I did find (part of) my problem - It was a bad solder at GPIO.4 so it was never seeing the zero crossing. Having fixed that, I now can dim the light up and down just like it is supposed to. However, (bet you saw this coming) when it is between full on and full off, it flickers randomly. The dimming works but it flickers until it gets to full on or full off. I am sure that this is a timing issue but can't see where to get at it. I am at 60 Hz, 120V. I am using the code as previously posted.

    I know that some of you (Mister_e) feel like you are beating a dead horse with this dimmer project, but if you can help me get through this, I will post my final code, circuit diagrams and parts lists so that anyone can build this and you will never have to deal with it again (hopefully!).

    Thanks (Mister_e)!

    Atom058

  7. #47
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    interesting. to me it's sounds like a an delay offset in the Zero Crossing. Done by the transformer AND the 470uF cap.

    Can be solved in software.

    Give me the transformer information, part #, voltage etc. I will work on this.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #48
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Post Transformer info

    Steve - Thanks for your reply - The transformer is from Jameco (www.jameco.com), P/N: 249412. The spec sheet says that I should be getting 8VAC @ 1.6A (I know that is a little over-kill on the amperage, but it is what I had lying around), but I am measuring 9.8VAC across the input to my bridge rectifier. Using a voltage divider (4k7 & 10K), that gets the DC voltage to GPIO.4 down to 4.33VDC. The cap is a 470 uF 25V electrolytic.

    Let me know if you need anything else... Thanks!

    Atom058

  9. #49
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Question

    Steve - Any luck with the info that I posted?

    I've been looking at some related posts and I am wondering if the timing problem is related to the maxdelay value. If I am running at 60 hz, that means that I complete 1 cycle every 16.7 mS. Or, I cross zero every 8.35 mS (8350 uS). Is that correct? In the code, MaxDelay is 6000 uS. Is this where my problem is?

    Can you tell me why the transformer and 470 uF cap is of interest to you? How does this affect my timing?

    Every day is a learning experience and I'm always looking for more!

    Thanks! Atom058

  10. #50
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Question Has anyone successfully built one of these?

    I would love to hear from anyone that has successfully built this dimmer that is discussed on this thread. I have followed the code and schematics (as well as the changes to both) and can not achieve the end result. The circuit and code, as it stands now, will allow me to go to full on and full off by quickly tapping the inc/dec buttons. This part works perfectly. If I press and hold the inc/dec buttons, the lighting level changes gradually, just like it is supposed to, but I get flickering. Mister-e seems to think that it is a timing issue - and I am in agreement, but I do not know where to make adjustments. If anyone can give me some trouble-shooting ideas, I would greatly appreciate it.

    I think this is a great design that has many uses. I would love to get it to work and post my final results!

    This circuit, once I get it right, is going to be the basis for a larger design, But until I get this part working, I can not move forward.

    Please help!
    Atom058

  11. #51
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes it's a timing problem, and there's no way to determine the exact one between all transformer brand and model. Adding a calibration process is possible but... usefull?

    grabbing the signal directly from the li ne is the only way i see to make it work with all transformer.

    Transformerless PSU is another way.... i hate that but if everything is properly done and insulated, the user shouldn't be hurt one day.

    Give me a couple of days.. i'm on a rush now.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #52
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Talking

    Steve - Thanks for your reply - I was actually on the path of a transformerless supply like you suggested. I have built the design that was presented by Melanie in another thread and get a nice clean 5VDC to drive my pic. I am pulling the AC for the trigger and putting it through a 20M dropping resistor (to go to pin 3 of my pic) per the schematic for the PIC REF-4 application note. However, this only drops the voltage to around 30V AC. Do I need to get it down to <= 5VAC or is 30VAC OK?

    Atom058

  13. #53
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I did something like that for one user here that use a 10Meg directly from the main to a PIC input. The PIC internal diode do their job. As now it seems to works. The user is still alive... Just make sure you properly insulate your stuff.....

    The 30VAC you get is without load...just your voltmeter.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #54
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks Steve! I will give it a try and let you know what happens!

  15. #55
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Talking It Works!!!

    Steve! The transformerless supply did the trick! Works like a charm now. In the next couple of days, I will post everything I have so that anyone can build this (and not bug you about it anymore).

    Thanks for all your help! Atom058

  16. #56
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=881&d=1148640458">
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #57
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    88


    Did you find this post helpful? Yes | No

    Thumbs up As Promised

    Here is the artwork, BOM and code for the new-and-improved AC Lamp Dimmer. Everything you need to make one. There is only one issue that I have with this but it is not important for my use, but maybe someone else can shed some light (!) on it. When going from full bright and dimming down, it makes a small "jump" down in brightness but then dims nice and smooth the rest of the way. I am sure it's a timing thing but I could not figure it out. Anyway, enjoy! And thanks to Steve (Mister_e) for his help and patience (nice dancing letters, by the way)!

    You'll be hearing more from me!

    Atom058
    Attached Images Attached Images
    Attached Files Attached Files

  18. #58
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Default How about this?

    <img src=" http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1906&stc=1&d=118620155 9">
    Attached Images Attached Images  
    Ohm it's not just a good idea... it's the LAW !

  19. #59


    Did you find this post helpful? Yes | No

    Question With DT_Interrupts added

    Quote Originally Posted by mister_e View Post
    Can't wait to return home... use the following ACDetect routine instead.
    this should work.
    Code:
    disable
    ACDetect:
    if ACline==1 then 
        '
        '    Rising edge of AC signal
        '    ========================
    	if triacdelay then              ' A delay is set by user
                                            '  
    	    if FullBright==0 then       ' Full Brightness flag is not set
                pauseus maxdelay-triacdelay '    do the selected delay
                triac=1                     '    enable TRIAC	    	
                else                        '
        	        triac=1                 ' Full Brightness flag is set
                                            '    enable triac
                endif                       '
                                            '
            else                            '
        	    triac=0                     ' No Delay set by user... disable Triac
            endif                           '
        
        else                                
        '
        '    Falling edge of AC signal
        '    =========================
            if fullbright==0 then triac=0   ' Disable the Triac on falling edge of 
                                            ' Ac signal
        endif
    INTCON.0=0 ' Clear GPIF (interrupt on GP4 change)
    resume
    enable
    Yeah i know you can also use Pulsout and forget the Falling edge detection... as you wish. Both will work.
    Very interesting thread I must say. I am trying to do the same and have added DT_INTERRUPTS to manage the ac detect....But my lamp is not dimming at all, also when in the code 'triacdelay=0', my lamp does not go off........ Can someone spot the error please.
    Code:
    INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    Include "modedefs.bas"
    @ __Config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD
    
    TriacDelay                  var Word
    maxdelay                    var word
    
    Triac	var	PortA.1 ' Output to TRIAC gate
    ACLine	var	PortA.2 ' Input for the FullWave rectify AC line
    Buz		var PortC.2
    
    TRISA = %001100
    TRISC = 0
    CMCON = 7
    ANSEL = 0
    OPTION_REG = %11000000  ' RAPU = off, PS WDT
    PORTA=0
    PORTC=0
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,  _ACDetect,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT_INT     ; enable external (INT) interrupts
    
    Triac=0            ' disable Triac Gate
    triacdelay=0  ' Set delay to minimum
    
    while 1
    
    pause 3000
    high buz: pause 500 : low buz
    triacdelay=8000     : pause 10000 :high buz: pause 50 : low buz 
    triacdelay=5000     : pause 10000 :high buz: pause 50 : low buz 
    triacdelay=4500     : pause 10000 :high buz: pause 50 : low buz 
    triacdelay=4000     : pause 10000 :high buz: pause 50 : low buz
    triacdelay=3500     : pause 10000 :high buz: pause 50 : low buz
    triacdelay=0 : pause 7000
    
    wend
    
    ACDetect:
    	if triacdelay > 0 then
    			if triacdelay=8000 then
    				triac=1 ' Activate TRIAC
    			else
    				maxdelay=8000-triacdelay
    				pauseus maxdelay
    				triac=1
    				pauseus 50
    				triac=0
       	     	endif
        else
     		     triac=0
        endif
    @ INT_RETURN
    P.S. I am using full wave with few high value resistance connected to phase and zeners to drop the voltage further.

  20. #60
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by FromTheCockpit View Post
    P.S. I am using full wave with few high value resistance connected to phase and zeners to drop the voltage further.
    What size zeners are you using?

    The INT input is Schmidt trigger, so it has to get above 4.0V to trigger the interrupt.
    It may not make it, or cause a delay after zero-crossing that could affect the timing.

    Have you tried it without the zeners?
    DT

  21. #61


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Darrel Taylor View Post
    What size zeners are you using?

    The INT input is Schmidt trigger, so it has to get above 4.0V to trigger the interrupt.
    It may not make it, or cause a delay after zero-crossing that could affect the timing.

    Have you tried it without the zeners?
    Hello Darrel, I made a slight mistake in the above post, it's not full wave rectified. The circuit goes like this - Phase->1.5Meg->12V zener->1K->4.7V zener->3.3Meg->PIC

    No I have not tried it without zeners yet. Will it be OK to remove the zeners from the above equation - the place where I am gets heavy voltage fluctuations - The variation could be from 170V - 280V AC (I am serious!)

  22. #62
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    According to the simulator, your resistors/zeners should give 4.4v, so that's ok. (but you shouldn't need the zeners)

    mister-e was using INT ON CHANGE, so it triggered on both edges.
    To get INT to do the same thing you have to toggle INTEDG on each interrupt.

    This modification of the handler works in the SIM.
    Code:
    INTEDG  VAR OPTION_REG.6
    ; ...
    
    ACDetect: 
        if INTEDG then
            if triacdelay > 0 then
                if triacdelay=8000 then
                    triac=1 ' Activate TRIAC
                else
                    maxdelay=8000-triacdelay
                    pauseus maxdelay
                    triac=1
                endif
            else
                triac=0
            endif
        else
            if triacdelay != 8000 then triac=0
        endif
    
        INTEDG = !INTEDG
    @ INT_RETURN
    In the scope image, the blue line shows the triac ON time.
    It's only on during the positive half of the cycle.
    Doesn't seem right, but that's the way mister-e had it.

    Name:  dimmer.JPG
Views: 3441
Size:  137.5 KB

    HTH,
    DT

  23. #63
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Read the previous post first.
    Then if you want both halves of the cycle, try this ...
    Code:
    INTEDG  VAR OPTION_REG.6
    ; ...
    
    ACDetect:
        if triacdelay != 8000 then triac = 0 
        if triacdelay > 0 then
            if triacdelay=8000 then
                triac=1 ' Activate TRIAC
            else
                maxdelay=8000-triacdelay
                pauseus maxdelay
                triac=1
            endif
        else
            triac=0
        endif
    
        INTEDG = !INTEDG
    @ INT_RETURN
    Name:  dimmer_2.JPG
Views: 2099
Size:  74.2 KB
    DT

  24. #64


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    According to the simulator, your resistors/zeners should give 4.4v, so that's ok. (but you shouldn't need the zeners)

    mister-e was using INT ON CHANGE, so it triggered on both edges.
    To get INT to do the same thing you have to toggle INTEDG on each interrupt.

    This modification of the handler works in the SIM.
    Code:
    INTEDG  VAR OPTION_REG.6
    ; ...
    
    ACDetect: 
        if INTEDG then
            if triacdelay > 0 then
                if triacdelay=8000 then
                    triac=1 ' Activate TRIAC
                else
                    maxdelay=8000-triacdelay
                    pauseus maxdelay
                    triac=1
                endif
            else
                triac=0
            endif
        else
            if triacdelay != 8000 then triac=0
        endif
    
        INTEDG = !INTEDG
    @ INT_RETURN
    In the scope image, the blue line shows the triac ON time.
    It's only on during the positive half of the cycle.
    Doesn't seem right, but that's the way mister-e had it.

    Attachment 4684

    HTH,
    Thanks Darrel, I just noticed that in your simulation there is no 1k between the two zeners, instead there is 3.3Meg. I will try the code and update here.

  25. #65


    Did you find this post helpful? Yes | No

    Default

    Hi, I tried the following first:
    Code:
    INTEDG  VAR OPTION_REG.6
    ; ...
    
    ACDetect:
        if triacdelay != 8000 then triac = 0 
        if triacdelay > 0 then
            if triacdelay=8000 then
                triac=1 ' Activate TRIAC
            else
                maxdelay=8000-triacdelay
                pauseus maxdelay
                triac=1
            endif
        else
            triac=0
        endif
    
        INTEDG = !INTEDG
    @ INT_RETURN
    RESULT: The bulb attached to the output did not responded to the change in triac delay value, it just kept glowing at the same intensity.

    Then I experimented a little and came up with the following:
    Code:
    while 1
    
    pause 3000
    high buz: pause 500 : low buz
    triacdelay=8000     : pause 15000 :high buz: pause 50 : low buz 
    triacdelay=7998     : pause 15000 :high buz: pause 50 : low buz 
    triacdelay=7950     : pause 15000 :high buz: pause 50 : low buz 
    triacdelay=7900     : pause 15000 :high buz: pause 50 : low buz
    triacdelay=7850     : pause 15000 :high buz: pause 500 : low buz
    triacdelay=0        : pause 12000
    
    wend
    
    
    ACDetect:
    ;    if triacdelay != 8000 then triac = 0 
        if triacdelay > 0 then
            if triacdelay=8000 then
                triac=1 ' Activate TRIAC
            else
                maxdelay=8000-triacdelay
                pauseus maxdelay
                    triac=1
                    pauseus 50
                    triac=0
            endif
        else
            triac=0
        endif
    
        INTEDG = !INTEDG
    @ INT_RETURN
    RESULT: The bulb responded to the changing value of triac delay, at value of 8000 it goes full bright which is normal BUT when at first lower value than 8000, it dims quiet a lot. I want it to dim a only a little at first step. I even tried 7998 after 8000 but no luck i.e. 2 uS delay.

  26. #66
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You're right, I had the resistors wrong.
    Making the change brought it up to 4.6V.
    But, having the zeners in there adds about 40uS to the zero-cross signal.
    It takes 35uS without the zeners, and 75uS with them.

    Add in the interrupt latency for PBP type interrupts, time to do math in the handler, the minimum pauseus of 24us, and taking into account that a half cycle of 60hz is 8,333uS ... I'm sure the first step was quite a bit dimmer.

    But the biggest problem is delaying inside the interrupt handler.
    When 90% of the time is spent in the handler, the pause 10000 in the main loop takes almost a minute.

    So here's my next attempt.
    It uses Timer1 for the delays, so the main program can keep running in the foreground.
    The handlers have been changed to ASM type to minimize latencies.
    And the math is done in a separate subroutine that only runs once when you change the brightness, instead of having to do the math on every zero-cross.

    It should be pretty close to the MAX/MIN dimming, but you may need to adjust the MaxBright/MinBright constants a little.
    If you adjust them too far, it will start flashing.
    Code:
    INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    Include "modedefs.bas"
    @ __Config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD
    
    MaxBright                   CON 8250    ; maximum brightness
    MinBright                   CON 200     ; minimum dimming 
    Brightness                  var word
    TriacDelay                  var Word
    AlwaysON                    var BIT
    AlwaysOFF                   var BIT
    OffPeriod                   var BIT     ; used by timer1 periods
     
    Triac	var	PortA.1 ' Output to TRIAC gate
    ACLine	var	PortA.2 ' Input for the FullWave rectify AC line
    Buz		var PortC.2
    
    INTEDG  VAR OPTION_REG.6
    TMR1ON  VAR T1CON.0
    TMR1IF  VAR PIR1.0
    Timer1  VAR WORD EXT
    @Timer1 = TMR1L
    
    TRISA = %001100
    TRISC = 0
    CMCON = 7
    ANSEL = 0
    PORTA=0
    PORTC=0
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,    _ACDetect,   ASM,  yes
            INT_Handler   TMR1_INT,   _T1Handler,   ASM,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT_INT     ; enable external (INT) interrupts
    @   INT_ENABLE  TMR1_INT     ; enable Timer1 interrupts
    
    Triac=0            ' disable Triac Gate
    brightness=0       ' Set delay to minimum
    gosub SetDelay
    
    while 1
        pause 3000
        high buz: pause 500 : low buz
        brightness=MaxBright   : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz 
        brightness=MaxBright-2 : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz 
        brightness=4500        : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz 
        brightness=4000        : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz
        brightness=3500        : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz
        brightness=MinBright   : gosub SetDelay : pause 10000 :high buz: pause 50 : low buz
        brightness=0           : gosub SetDelay : pause 7000
    wend
    
    SetDelay:
        Brightness = Brightness min MaxBright                    ; limit maximum brightness
        AlwaysON  = !(Brightness != MaxBright)                   ; MaxBright is always ON
        AlwaysOFF = !(Brightness != 0)                           ; 0 is always OFF
        if !AlwaysOFF then Brightness = Brightness max MinBright ; limit minimum dimming
        triacdelay = -(MaxBright - Brightness)                   ; calc delay time
    RETURN
    
    ;------------------------------------------
    T1Handler:
        if OffPeriod then            ; triac delay finished
            OffPeriod = 0
            triac=1                  ; turn on triac
            Timer1 = -50             ; load timer for 50uS
        else
            triac = 0                ; turn off triac after 50uS
            TMR1ON = 0 
        endif
    @ INT_RETURN
    
    ;------------------------------------------
    ACDetect:
        if AlwaysON then
            triac=1 ' Activate TRIAC
        else
            if AlwaysOFF then
                triac = 0
            else
                Timer1 = triacdelay  ; load delay into timer
                TMR1IF = 0           ; clear the interrupt flag
                TMR1ON = 1           ; start the timer
                OffPeriod = 1        ; tell T1Handler this is the main delay
            endif
        endif
    
        INTEDG = !INTEDG             ; toggle INTEDG to get both edges
    @ INT_RETURN
    Hope that works better.
    DT

  27. #67


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel, I am on 50Hz, do I need to change any value in the code for that??

  28. #68
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    There's another reason for the first step being much dimmer.

    Half a cycle of 50hz, is 10,000uS.
    So take MaxBright up to 9900.
    DT

Similar Threads

  1. PICDIM Lamp Dimmer for the PIC12C508 - PICREF-4
    By charudatt in forum General
    Replies: 8
    Last Post: - 2nd September 2015, 07:14
  2. Dimmer switch
    By iugmoh in forum Off Topic
    Replies: 4
    Last Post: - 20th March 2009, 16:02
  3. Ideas on ir-code for dimmer
    By tirithen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th February 2009, 23:22
  4. 50hz sync for light dimmer
    By tirithen in forum General
    Replies: 2
    Last Post: - 6th September 2008, 19:29
  5. Dimmer Circuit
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th January 2007, 14:37

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts