+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Newbie level 6
    Points: 514, Level: 4

    Join Date
    May 2010
    Posts
    12
    Helped
    0 / 0
    Points
    514
    Level
    4

    Generating two different PWMs from PIC18F2550

    Hi,
    I'm used to make codes for just one PWM, but now I need to control a step motor and a dc motor. My problem is I have to generate 2 very different frequencies. I'm using C18, and what I saw in datasheet is that I just can change the value in function OpenPWMx(XX), because TMR2 Prescale Value and Tosc are equal for both. However, I made a code and simulated in proteus, when I put a very low value, the both PWM doesn't work, when I put a higher value they seems to oscilate equal. I thought using a pwm code but I need to use A/D converter and another digital sensors. So I need to use pwm pins.
    Someone could help me? Is there a way to make it right?
    Thanks,
    ps: My english is not so good, so I'm sorry if it's hard to understand something.

    •   AltAdvertisment

        
       

  2. #2
    Newbie level 6
    Points: 514, Level: 4

    Join Date
    May 2010
    Posts
    12
    Helped
    0 / 0
    Points
    514
    Level
    4

    Re: Generating two different PWMs from PIC18F2550

    I was reading Pic18f2550's datasheet and seems I could use TMR3 and TMR1 for PWM1 e PWM2, so there is a different frequency source for each PWM. But I couldn't make it work. Someone knows how to do it?
    Thanks for helping.



--[[ ]]--