Menu

Help with softPWM

Help
2008-12-01
2013-05-30
  • Nobody/Anonymous

    I want to turn on an output pin with 50% dutycycle and leave it on like 5 s then I tell it to put that pin low (will that turn the pwm off?)
    can i do this with the software pwm?
    similar to the hardware pwm but i don't have that option on the 16f685 the way i have it hooked up.

     
    • Nobody/Anonymous

      See the PWMout command, it uses software PWM.  After the PWMout command completes, set the output low.

      Depending, you may decide to perform the PWM in other ways, such as an interrupt.

       
      • Nobody/Anonymous

        i don't want it to complete, i want it to run until i tell it to stop

         
    • Nobody/Anonymous

      It is possible to write your own loop for this, but a little tricky depending on other needed tasks.  But doable.  Start timer1, read the current value in your loop, toggle output depending.
      If you are going to want to do other tasks, or need higher accuracy, then you will probably want to use an interrupt.
      I have successfully used an interrupt to perform a software PWM with GCbasic.

       
    • Tom

      Tom - 2008-12-11

      Just to clarify, what are you looking for?

      Do you want a 50% duty cycle for 5 second then go low?

      or

      Do you want a 50% duty cycle that goes low when triggered by another input?

      Tom

       

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.