• AVR Freaks

Hot!PIC10F320 MCC PWM

Author
connyake
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2020/07/19 10:50:18
  • Location: 0
  • Status: offline
2020/08/11 02:00:16 (permalink)
0

PIC10F320 MCC PWM

It's been many years since I used a PIC.
I'm trying to set up a PWM with MCC for a PIC10F320. According to the datasheet I should be able to get a 25kHz PWM with a 7-bit resolution. But when I try to set it up with MCC the maximum frequency I can get is 25Hz with a 2-bit resolution.
What am I doing wrong?
 

Attached Image(s)

#1

4 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1861
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: PIC10F320 MCC PWM 2020/08/11 12:05:20 (permalink)
    0
    Did you try to change the timer period (change the prescaler to get a different period range)?
    post edited by katela - 2020/08/11 12:07:39

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #2
    davea
    Super Member
    • Total Posts : 299
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: PIC10F320 MCC PWM 2020/08/11 16:38:42 (permalink)
    0
    set PR2 !=1 
    ie: 255 or 64us
    #3
    ric
    Super Member
    • Total Posts : 28299
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC10F320 MCC PWM 2020/08/11 17:46:05 (permalink)
    +4 (4)
    MCC is screwing up the calculations.
    TMR2 is running at 4MHz period, not 25 Hz
    If you set the Timer prescaler to 1:4, and the "Timer period" to 32us, you will get 31.25 kHz update with 7 bit resolution.
    (Or you can leave the prescaler on 1:1 and get 9 bit resolution)
     
    post edited by ric - 2020/08/11 17:51:23

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    connyake
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2020/07/19 10:50:18
    • Location: 0
    • Status: offline
    Re: PIC10F320 MCC PWM 2020/08/12 03:42:32 (permalink)
    0
    Thanks Ric! That's what i thought Smile: Smile
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5