Strangw results when using PWM command


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Thanks once again for all you help. I had given up and wrapped up the board to post it to my mate, however I took it out of the jiffy bag and gave it one last try...

    I copied and pasted the code in your last post (the first program) and tried that. It compiled fine and loaded into the PIC, however the code does exactly the same as all other attempts. ie it ramps (for want of a better word) up the brightness to full, and then goes off, then repeats the same. It still doesn't ramp down from full brightness to low like it should - I've tried different PICs so it rules out that as being the cause.

    I think I'll call it a day on this.. thanks again for your help

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


    Did you find this post helpful? Yes | No

    Default

    That's really strange... it's working here using the first code of my previous message.

    Ramp-up, ramp-down in an endless loop... mmm.

    I suspect a hardware problem but damn it's not a really complicated hardware, i removed all the usual capacitor around, nothing on all other i/o, simple LED+300 ohm resistor... work fine. if i raise down the psu voltage... it's working from 2.5V. so uneless your Vdd rail is below or really noisy causing a RESET... i don't see why it shouldn't work.
    Last edited by mister_e; - 9th July 2006 at 19:47.
    Steve

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

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve,

    Rest assured your code works fine.. I've just breadboarded the PIC and it works, yet in the PCB ot only wants to ramp up ????? - strange !!

    I would of thought that if there was something wrong with the PCB I made (like a short) then the thing would not work full stop ! The board uses a 5.1 zenner to provide the supply to the PIC, and the output simply from GPIO 0 drives the gate of the FET and the LED - why it ramps up and not down I don't know ?

    Thanks mate.. don't waste any more of your time... I've attached the schematic just in case someone might see whats the issue ?
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    assuming 12Vin and R4 is really 10K: (12-5)/10K = 0.7mA

    No problem when only the PIC run... but when the LED is attach to.. the voltage will really reduce ... 'till the PIC reset.

    your problem is there, you don't provide enough current, Zener would need at least few mA just for her +Led+Pic... Repace R4 to 200Ohm

    @12Vin : (12-5)/200=35mA
    @9Vin : (9-5)/200 = 20mA

    @12 Vin : 35mA*35mA*200Ohm = 1/4 Watt

    Or better if you replace it for a voltage regulator like 78L05 or any else
    Steve

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

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve

    Thanks mate for your further help,

    The reason I opted for using a zenner, was the last time I used a 7805 to run a few LEDs the thing glowed trying to disapate the heat !

    I'll see if changing the resistor does the trick

    Malc

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


    Did you find this post helpful? Yes | No

    Default

    7805 is 1Amp rated
    78L05 ~100mA
    Steve

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

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Steve, went the hole hog and dropped in a 68R and it works a treat !!

    Thanks for your help

    Cheers

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


    Did you find this post helpful? Yes | No

    Default

    You're welcome... just make sure that your Zener and resistor are rated to handle it ...
    Resistor 68ohm... (12-5)/68=103mA, 103mA*103mA * 68 = 0.72W => 1 watt
    Zener 5 Volt : 5*103mA = .515 Watt => could be 1/2 watt... i calculate the worst case, VMax,No Load
    Last edited by mister_e; - 9th July 2006 at 20:48.
    Steve

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

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 21:31
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 07:03
  3. turning gpio.0 high after pwm command
    By sirvo in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st February 2007, 19:22
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 19:57
  5. Searches
    By bearpawz in forum Forum Requests
    Replies: 11
    Last Post: - 7th November 2005, 19:47

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