Menu

PWM16 on 16F17114

ZBolan
4 days ago
3 days ago
  • ZBolan

    ZBolan - 4 days ago

    Hi,

    I am just getting started with PIC/GCBASIC so forgive me if I am missing something here. When I attempt to use HPWM16 on a 16F17114 I receive the error

    Chip cannot support PWM16 commands. Either chip is not supported, or, not validated with this chip

    I checked and CHIPPWM16TYPE is not listed in the dat file at all but the Microchip website lists 2x 16-bit PWM with Dual Outputs under the features.

    Any help would be appreciated!

     
  • HackInBlack

    HackInBlack - 3 days ago

    it seems as though there's only 10-bit PWM hardware on this chip range...sneaky!

     
  • ZBolan

    ZBolan - 3 days ago

    Thank you so much! I totally missed that.

     
  • Anobium

    Anobium - 3 days ago

    You should try using the 16Bit PWM demo file as your starting point. There is a 16Bit PWM demo of a chip in the same family. Do a search in GCCODE, open the Demo folder and look for the 16F171 demo folder. I can look the actual demo tomorrow if you cannot find it.

     
    • ZBolan

      ZBolan - 3 days ago

      Hi Anobium, I was not able to locate that 16F171 demo folder but I would be very interested in taking a look if you have the time. Thank you!

       
  • Anobium

    Anobium - 3 days ago

    C:\GCstudio\gcbasic\demos\Vendor_Boards\Great_Cow_Basic_Demo_Board\16F17126_chiprange_demonstrations

    Specifically, 250_pwm16bit_variable_modes

    This is the 16bit process as defined in many of the 16bit PWM solutions in the demo pack.

    Change your chip, change the PPS, change the Port Constants and give it a go.

    Evan

    // Setup all the registers.  This is shown the demo with good documentation.
    
    // You must toggle PWM1CON to set the new paramaters
    
    // Create an alias to the PWM1 duty register
        Dim PWMval as word alias PWM1S1P1H, PWM1S1P1L
    
        Do
              for PWMval = 0x00 to 0x3E8
                wait 1 ms
                PWM1CON = 0x00
                PWM1CON = 0x80
              Next
              wait 2  s
    
              for PWMval = 0x3E8 to 0x00 Step -1
                wait 1 ms
                PWM1CON = 0x00
                PWM1CON = 0x80
              Next
              wait 2 s
    
        Loop
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.