marad75


Closed Thread
Results 1 to 4 of 4

Thread: marad75

  1. #1
    Join Date
    Dec 2005
    Posts
    23

    Question marad75

    Hi, I'm fairly new at this. I am using a 16F84 with two a/dc's. I can do the math in PBC ok, but am having trouble getting the output type I need. I need a PWM output that can be set up for 0 to 100% duty cycle. Can anyone help with a routine that uses, maybe, PWM output or PULSOUT with pauses? Or maybe just HIGH, X, Pause, X, Low,X, or whatever. Really stumped.
    Thanks in advance, Ron

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You have three options...

    1. Your PBC has a command called PWM... go check it out in the manual - it even comes with an example.

    2. Do s SEARCH on this forum (use PWM* as the search phrase) for heaps of topics on PWM many with examples.

    3. Swap your 16F84 (I really don't know why folks still use this chip) for a pin compatible 16F628 which has hardware PWM on-board... the Datasheet in the Capture/Compare/PWM (CCP) Section explains step-by-step how to initialise and get that running...

  3. #3
    Join Date
    Dec 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Cool older PBC and PBP

    Hi Melanie,
    Thanks for your reply to my PWM question! I have older versions of both PBC and PBP. Neither of them include the 16F628. I would upgrade to later versions, but am on Social Security and money is tight. Besides, the 16F84 is doing well for this project. All other functions work well on this. (Radio Control hobby project)
    Now, could I use a PulsOut command and scale the length value until the resulting "PWM" function is approximately right? (relative to the off time to go through the program again) Am using a 4 meg XT and there are actually two outputs for this project, each doing a separate "PWM" thing. Where I run into a "senior moment" with this is USING THE PULSOUT COMMAND, I AM ONLY USING 1 CYCLE OF "PWM" for each of the two outputs, that occur each time the code loops through.
    If I use real PWM on the 16F84 with a variable for the duty and, say, 10 cycles, will the pwm have to complete the full 10 cycles before upgrading? Or will the duty variable be upgraded each time the program loops through again?
    I hope this makes sense and THANKS MUCH FOR YOUR HELP!!
    Ron

    PS this is all in PBC

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you specify your 10 cycles for PWM, then it will execute those tens cycles before exiting and continuing with your next instruction.

    You may want to check out Darrel Taylors PWM routine that can sit and run in background whilst you're doing other things...

    http://www.pbpgroup.com/modules/wfse...hp?articleid=6

    ...and if that excites you try...

    http://www.pbpgroup.com/modules/wfse...p?articleid=12

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts