Variable PWM PIC18F2431


Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    May 2009
    Posts
    5

    Default Variable PWM PIC18F2431

    Hi guys Im EE student Im doing a project where I need 2 PWM signals: 1 fixed PWM and 1 variable PWM using A/D module.
    Im using POWER CONTROL PWM MODULE.

    I did fixed PWM and it worked perfect, I tested with some PWM frequencys and some duty cycles, here I dont have troubles.

    Variable PWM my analog input is a rectified sinusoidal wave at 60 Hz, Im using AN0, Im working in this project since April and I have troubles here, my output isnt working in the correct way. I was using 8 MHz cristal with HSPLL enabled so Fosc = 32 MHz, I had FPWM = 100 KHz at 8 bits PWM resolution, I was loading the 8 MSB to Duty Cycle register... but I cant get the correctly output, so the last Wednesday I get a 10 MHz cristal now I have Fosc = 40 MHz, and 10 PWM resolution bits at FPWM = 39 KHz.. I loaded the 10 A/D result bits to the 10 PWM duty cycle bits and I still having troubles, the PWM output is working bad, some times the output go to 5 Volts (100% duty cycle) or go to 0 Volts (0 % duty cycle) or stay freeze in a low duty cycle, some times didnt stop.

    About my A/D configuration, Im using single shot, Im trigering A/D convertion by software, A/D interrupt disable, my TAD is Fosc/32, and my TACQT = 2TAD, I have followed the A/D configuration steps from datasheet.
    Im using PWM free-running mode.
    To read the A/D result Im using a PWM interrupt each time that interrupt is active Im reading the A/D result and loading to Duty Cycle registers.

    I hope somebody can help me please I need finish it, this project is my thesis from university, its a led ballast, the variable PWM signal will be used for a CD-CD converter Boost to made a PFC, the fixed PWM will be used for a CD-CD converter Buck, Im in darkness in variable PWM since April I dont know what can be the trouble I read my code, read datasheet, Im going to be crazy =P

    I show You my hardware connection and my variable PWM output in a video.
    I have attached my code.

    http://img33.imageshack.us/img33/6127/hardwarepwm.jpg
    >>> Hardware connection

    http://img5.imageshack.us/img5/4380/pwmanaloginput.jpg
    >>> Analog input

    http://www.fileden.com/getfile.php?f...able%20PWM.wmv
    >>> Variable PWM output video

    Note: please copy and paste the url-links to your web browser.

    Thank You for Your time.
    Regards.
    Tom.
    Attached Files Attached Files

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  3. Variable PWM on 2 Channels using software.
    By Tissy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd September 2006, 01:34
  4. pwm to pin using variable
    By wsmrite in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th April 2006, 17:08
  5. Tidying Up PWM Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st February 2005, 00:26

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