Power Control PWM, HELP needed


Results 1 to 19 of 19

Threaded View

  1. #9
    Join Date
    Jun 2013
    Posts
    11


    Did you find this post helpful? Yes | No

    Default Re: Power Control PWM, HELP needed

    Last two questions (I hope so )
    in Bruce's Example he's multiplying pdcx by (Lowbyte,Highbyte) Low and high byte of what and what is the purpose of doing that ?
    also
    anyway I'm going to post the Code since I can't find the problem yet .. what I'm Trying to do is to generate a sinewave from pwm0 with an offset to use that later in a three phase inverter.. so I made this test which gives unexpected results
    what I'm trying to do is using entries from a lookup table to generate pulses with duty cycles starting from 1000 to 2000 then back to 1000 (Positive half Cycle) after that going from 1000 to 0 and going back again to 1000 (Negative half Cycle) which isn't happening ..
    I'm using 10MHz osc 18f4431, and a lookup table of 25 Entries (Which isn't enough for a smooth wave but this is for testing)

    Code:
    PORTB = 0
    TRISB = %11000000 ' pwm0-5 output
    PTCON0 = %00000000 '   (1:1) prescale , Free-Running mode 
    PTCON1 = %10000000 'time base is on, Counting is up
    PWMCON0 = %01000000 'Pwm0-5 enbbled for pwm output, pwm0-5 complementary mode
    PWMCON1 = %00000001 
    OVDCOND = %11111111  
    PTPERL = $D0
    PTPERH = $07     'PTPER = 2000
    Main:
    PDC0L = 00 
    PDC0H = 10
    
    PDC0L = 59
    PDC0H = 12
    
    PDC0L = 00
    PDC0H = 15
    
    PDC0L = 07
    PDC0H = 17
    
    PDC0L = 66
    PDC0H = 18
    
    PDC0L = 66
    PDC0H = 19
    
    PDC0L = 00
    PDC0H = 20
    
    PDC0L = 66
    PDC0H = 19
    
    PDC0L = 66
    PDC0H = 18
    
    PDC0L = 07
    PDC0H = 17
    
    PDC0L = 00
    PDC0H = 15
    
    PDC0L = 59
    PDC0H = 12
    
    PDC0L = 00
    PDC0H = 10
    
    PDC0L = 41
    PDC0H = 07
    
    PDC0L = 00
    PDC0H = 05
    
    PDC0L = 93
    PDC0H = 02
    
    PDC0L = 34
    PDC0H = 01
    
    PDC0L = 34
    PDC0H = 00
    
    PDC0L = 00
    PDC0H = 00
    
    PDC0L = 34
    PDC0H = 00
    
    PDC0L = 34
    PDC0H = 01
    
    PDC0L = 93
    PDC0H = 02
    
    PDC0L = 00
    PDC0H = 05
    
    PDC0L = 41
    PDC0H = 07
    
    PDC0L = 00
    PDC0H = 10 
    
     GoTo Main
    Thanks
    Last edited by Kloney; - 4th July 2013 at 09:19.

Similar Threads

  1. Power advice needed
    By bearpawz in forum Schematics
    Replies: 4
    Last Post: - 29th October 2010, 22:17
  2. CCP vs power control PWM
    By luminas in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th September 2008, 04:09
  3. Help needed - MOSFET driven by PWM
    By bcd in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd April 2008, 06:02
  4. Servo control / UART / SPI help needed
    By Blackhawk in forum mel PIC BASIC
    Replies: 10
    Last Post: - 10th November 2006, 04:40
  5. Replies: 5
    Last Post: - 23rd February 2005, 18:35

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