Menu

pwm.h library Error

B D
2026-06-17
2026-06-19
  • B D

    B D - 2026-06-17

    Hi GCBASIC community,

    The current pwm.h library causing compilation errors on devices like PIC12F683.

    To fix this, we updated pwm.h using if condition.

                      #if def(DC1B0)                        
                        ' For devices like PIC12F683 that use DC1B1/DC1B0 definitions
                        DC1B1 = DutyCycleL.7
                        DC1B0 = DutyCycleL.6
                      #else def(CCP1X)
                        ' For devices like PIC16F877A that use CCP1X/CCP1Y definitions
                        CCP1X = DutyCycleL.7
                        CCP1Y = DutyCycleL.6
                      #endif
    
     
  • Anobium

    Anobium - 2026-06-17

    Thanks, again.

    Please post the library you have adapted. I will do a diff to ensure the change is merged.

     
  • B D

    B D - 2026-06-17

    Here is the adapted pwm.h file. I have attached it to this post.
    Thanks for your interest.

     
  • Anobium

    Anobium - 2026-06-17

    Can you post a GCBASIC source program that shows the error?

    I want to see the error here.

     
    • B D

      B D - 2026-06-17

      Unfortunately, I've already edited the original file. I was getting a compilation error around lines 461 and 462 in the pwm.h file. The error was occurring for either the 12F683 or the 16F877A.
      Then I edited the pwm.h file to support both microcontrollers properly. You can try generating PWM on the 16F877A and 12F683 with the original library to see the compilation error.

       
  • Anobium

    Anobium - 2026-06-18

    Sorry, I cannot reproduce.

    Am I using the correct HPWM instructions?

    I tried a new and an old installation of GCBASIC and got no errors.

    Evan

    // #chip 12F683
    #chip 16F877A, 20 
    #option Explicit
    
    
    PWMON
    
    //! or
    
    HPWM 1, 50, 128
    
     
    • B D

      B D - 2026-06-18

      Hi, I am a beginner at GCBasic, so please accept my apologies if I am making a silly mistake. To clearly replicate the issue I experienced from the very beginning, I did a fresh install of GCB Studio. I have also taken screenshots so you can see the error first-hand.

       
  • Anobium

    Anobium - 2026-06-18

    You have done a great job.

    Post the source GCB and the ASM being produced. You may want to create a zip file.

     
    • B D

      B D - 2026-06-18

      I hope it helps you fix this error.

       
  • Anobium

    Anobium - 2026-06-18

    pAlso, post the original pwm.h

     
    • B D

      B D - 2026-06-18

      I hope it helps you fix this error.

       
  • Anobium

    Anobium - 2026-06-19

    Use the PWM.H there was a fix in December 2025 ( therefore after the release you have ) to resolve an issue with legacy 8,9&10bit CCP1.

    Work ok on test here with your code.

    Thanks for reporting.

     

Log in to post a comment.

Auth0 Logo