HPWM with 18F4220


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78

    Default HPWM with 18F4220

    Hello everyone,

    I am planning on using a pic with multiple PWM (around 4PWM) . I was looking into the PIC18F4220 which has up to 4 PWM modules. I have just checked to see if pbp supports this controller and it does. I am currently using PBP version 2.45. I have also read the section on HPWM in the compiler and it does not mention anything about how to execute 4 HPWM channels. in the product data sheet it mentions that the pin associated with each of the PWM channels are the following
    PWM OUTPUT 1A --> PORTC.3
    PWM OUTPUT 1B --> PORTD.5
    PWM OUTPUT 1C --> PORTD.6
    PWM OUTPUT 1D --> PORTD.7
    here is what I am wondering, how do i write code so that I can utilize each of the PWM module. becasue I plan to use all of the four module. Any help with code examples would be greatly appreciated. many thanks in advance

    srigopal

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


    Did you find this post helpful? Yes | No

    Default

    hi srig.

    HPWM 1,duty1,1000 ;PWM channel 1

    HPWM 2,duty2,1000 ;PWM channel 2

    HPWM 3,duty3,1000 ;PWM channel 3

    HPWM 4,duty4,1000 ;PWM channel 4

    that's it. In many case frequency of PWM must be the same on each channel.


    regards
    Steve

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

  3. #3
    Join Date
    Jul 2004
    Location
    CA
    Posts
    78


    Did you find this post helpful? Yes | No

    Question

    but I contacted the pbp support line and they said that for the first two you can use the HPWM command but for the last two I will need to set up the registers and go through all the process of manually setting the registers and basically they said to do it the long wayyy.. thats is the only way to go about working this 4 channel HPWM feature on the 18F4220. This is waht the pbp support people said.


    srigopal.

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


    Did you find this post helpful? Yes | No

    Default

    mmm good to know that. i<ve never use more than 2 HPWM.
    Steve

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

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  4. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 03:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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