3 HPWM channels with PIC18F26K20


Closed Thread
Results 1 to 5 of 5
  1. #1

    Lightbulb 3 HPWM channels with PIC18F26K20

    Hi everyone,

    I'm new here avec I hope find help here.

    I'm currently making a 3-phase variable frequency drive with PicBasic Pro and a PIC18F26K20 (28-pin, 64MHz, 3.3V). For simulation, I'm using ISIS Proteus.

    I have to define 3 PWM hardware channels (one for each phase U, V and W) with the HPWM command.
    My PIC have CCP1 on PORTC.2, CCP2A on PORTC.1 and CCP2B on PORTB.3.

    So here my simple test program :

    define OSC 64

    DEFINE CCP1_REG PORTC
    DEFINE CCP1_BIT 1
    DEFINE CCP2_REG PORTC
    DEFINE CCP2_BIT 2
    DEFINE CCP3_REG PORTB
    DEFINE CCP3_BIT 3

    HPWM 1,127,8000
    HPWM 2,100,8000
    HPWM 3,50,8000

    Unfortunately, in Isis, only HPWM1 and HPWM2 works well, but not the HPWM3 (no action). I don't know why.
    My registers are maybe misdefined?

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Hello, and welcome to the forum!

    From the data sheet.....

    11.0 CAPTURE/COMPARE/PWM
    (CCP) MODULES
    PIC18F2XK20/4XK20 devices have two CCP
    Capture/Compare/PWM)

    See the fine print by PortB.3 CCP2^1
    Note 1: RB3 is the alternate pin for CCP2 multiplexing.

    If you want to look at some devices that have more, you can do a parametric search here:
    http://www.microchip.com/maps/microcontroller.aspx
    Last edited by ScaleRobotics; - 12th January 2011 at 18:11.
    http://www.scalerobotics.com

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Hello, and welcome to the forum!

    From the data sheet.....

    11.0 CAPTURE/COMPARE/PWM
    (CCP) MODULES
    PIC18F2XK20/4XK20 devices have two CCP
    Capture/Compare/PWM)

    See the fine print by PortB.3 CCP2^1
    Note 1: RB3 is the alternate pin for CCP2 multiplexing.

    If you want to look at some devices that have more, you can do a parametric search here:
    http://www.microchip.com/maps/microcontroller.aspx
    Thanks for your fast answer, well I will buy the PIC18F4431 instead, with eight PWM outputs, it will be fine.

    But I can simulate in Isis any PIC I want, so I try to feed a simulated PIC18F4431 with the same program as above (compiled with the right PIC setting of course in MicroCode Studio).

    And like my PIC18F26K20, only two HPWM outputs are working. What's wrong?

  4. #4
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Check out Bruce's post here, and Darrels right above it: http://www.picbasic.co.uk/forum/show...3820#post43820

    Those are great chips, so you could either do it manually, or you could switch to an older chip, like the PIC18F452.
    http://www.scalerobotics.com

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Check out Bruce's post here, and Darrels right above it: http://www.picbasic.co.uk/forum/show...3820#post43820

    Those are great chips, so you could either do it manually, or you could switch to an older chip, like the PIC18F452.
    Thanks, I will look at it.

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