PICDIM Lamp Dimmer for the PIC12C508 - PICREF-4


Results 1 to 9 of 9

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    O.k

    all you need to know @50Hz

    Period : 20 ms
    1/2 period :10 ms

    i'll prefer to detect begining of each cycle using the appended circuit...

    You must detect begining of cycle, then activate output to TRIAC for a maximum delay of 10ms including when your PIC is detecting the begining of the cycle. Let's say your PIC is detecting the cycle after 1ms of the begining, you must wait a maximum of 9 ms. Can be intelligent to use a PIC who have internal voltage comparator here.


    try the following code as a begining.

    Code:
    'Using PIC16F628
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF 
    
    TRISB=%00000001
    
    BeginingCycle    var PORTB.0
    OutputToTriac    var PORTB.1
    delay            var byte
    Hold             var word
    
    while BeginingCycle
    wend
    start:
    For delay=0 to 8
         for Hold=1 to 100
              while BeginingCycle=0
              wend
         
              OutputToTriac=1
              Pause delay
              OutPutToTriac=0
              While BeginingCycle
              Wend
         Next
    next
    
    goto start
    Attached Images Attached Images  
    Last edited by mister_e; - 20th December 2004 at 22:12.
    Steve

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

Similar Threads

  1. Plz help in completing RC-5 IR remote lamp dimmer project
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2008, 08:44
  2. Lamp Dimmer on ME Website
    By jw666 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st August 2007, 17:14
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

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