turning gpio.0 high after pwm command


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108

    Default turning gpio.0 high after pwm command

    i've just developed a dimmer for the internal light of the car using pic12f629 but i've a problem:

    when gpio.1 goes low, gpio.0 goes high (turning the lamp on) (gpio.0 = 1)
    just after that, when gpio.1 goes high, gpio.0 goes low with PWM. (pwm gpio.0,duty,cycle)

    at the first execution, it works fine. But if gpio.1 goes low again, gpio.0 DOESNT go high and when gpio.1 goes high, the PWM works...

    the code is attached.

    thanks, Sylvio
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    I remember of few strange behaviour with this specific PWM. As far as i remind, it trick the TRIS setting and sometimes it set the i/o to input at the end.

    Try to use LOW and HIGH after PWM instead of using Io=1 or Io=0
    Steve

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

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi Sylvio. I had a similar problem with the 16F819. It turns out that before I could reuse that port as an output, I had to disable the PWM with
    CCP1CON = 0 'TURN OFF PWM
    Maybe this will help.

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


    Did you find this post helpful? Yes | No

    Default

    i wasn't aware that a 12F629 had a CCP module
    Steve

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

  5. #5
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Smile

    he.. peterdeco.. mister e is correct, pic12f629 has no CCP module..

    thanks for the suggestion.

    i'm using soft pwm ..

    mister e, i have changed everything to HIGH and LOW and it worked really fine!

    thanks a lot...!

    Sylvio

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


    Did you find this post helpful? Yes | No

    Default

    Bah don't blame Peterdeco, it's usual to everyone to mix PWM, HPWM and miss something in a post.

    Glad to know it's working. At least my memory was good this time

    Enjoy!
    Steve

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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve. I don't have these devices memorized. I saw PWM and it reminded me of my 16F819 problem a year or 2 ago.

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


    Did you find this post helpful? Yes | No

    Default

    Bah, no problem Peterdeco1, even a superhero may fail... even me

    You where right, with a CCP module your solution will work. The only thing i would add for safety sake is a LOW pin after.

    But i'm an old guy using old method... LMAO!
    Steve

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

Similar Threads

  1. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 20:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. need help simulating PS/2 mouse
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th December 2007, 21:49
  4. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37
  5. Strangw results when using PWM command
    By malc-c in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 10th July 2006, 12:14

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