Dimmer


Closed Thread
Results 1 to 40 of 68

Thread: Dimmer

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Mister-E - No harm done! Thanks for the quick response! I will give it a try tonight and we'll see what happens.

    Atom058

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


    Did you find this post helpful? Yes | No

    Default PIC Issue

    I was trying to program a PIC12F675 to work with this dimmer design and I am obviously missing something. I copied the code from the Dimmer example and it was not working so I moved to a breadboard to do some testing. I can not even make an output on these PIC's go high! I know I am missing something but I can't imagine what it is! Here is the code - as simple as it is:

    @ DEVICE INTRC_OSC_NOCLKOUT & WDT_ON & MCLR_OFF & PWRT_ON & BOD_ON

    PAUSE 500
    CMCON=7 ' Disable analog comparator
    ANSEL=0 ' Disable analog converter

    TRISIO = %11111111
    TRISIO.0 = 0
    TRISIO.1 = 0
    TRISIO.2 = 0
    TRISIO.3 = 0
    TRISIO.4 = 0

    HIGH GPIO.0
    HIGH GPIO.1
    HIGH GPIO.2
    HIGH GPIO.3
    HIGH GPIO.4

    Start:
    GOTO Start

    END

    Now, correct me if I am wrong, but I should be able to measure 5V at each of the 5 outputs above. I get nothing. I have tried several PICs and get the same results. I've written hundreds of programs for different PICs and this one has beaten me. I know the solution is unbelieveabley simple, but GEEZ!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Atom058
    ...
    @ DEVICE INTRC_OSC_NOCLKOUT & WDT_ON & MCLR_OFF & PWRT_ON & BOD_ON...

    Hi Atom,

    First thing, try these instead of the line above.

    Code:
    @ 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
    These should fix your problem.


    Second thing, GP3 is an input-only pin. Never goes high.



    ----------------------
    Last edited by sayzer; - 12th October 2006 at 03:38.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    Your @ device line is faulty...
    If you'e using PM to compile your code you must use something like
    Code:
    @ device  pic12F675, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
    With MPASM
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    OUPS! SAYZER WHY YOU REPLYED AT THE SAME TIME

    i know this one is familiar to you
    Steve

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

  5. #5
    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

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


    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

  7. #7
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    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

  8. #8
    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.

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 : 0

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