Pwm 16f628


Closed Thread
Results 1 to 5 of 5

Thread: Pwm 16f628

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    First there is no RB8, there is a RB7 though which is the 8th bit.

    Are you reading a DIP switch or something?

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I would read the port by using:

    Code:
    pwm_value.0 = portb.4
    pwm_value.1 = portb.5
    pwm_value.2 = portb.6
    pwm_value.3 = portb.7
    This will load the value between 0-15 in the byte sized variable pwm_value. If your running @ 4 MHz then you could use:

    Code:
    pwm portb.0,127,60
    This would give you a 50% duty cycle for about 300ms out on portb.0. Or you can use the hardware PWM which is on portb.3.

  3. #3
    mladenovic's Avatar
    mladenovic Guest


    Did you find this post helpful? Yes | No

    Default Pwm

    Hi
    Thanks for help.
    Those 4 bits I get from PC parallel port.
    I would like to know how to use HPWM?
    Milan

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I think about the only thing you have to do is:

    Code:
        hpwm 0,pwm_value,32767
        pause 300
        CCP1CON = 0
    The first line starts the PWM at whatever value is stored in the pwm_variable at 32.767kHz. It then pauses for 300ms then turns off the HPWM.

Similar Threads

  1. Half-bridge PWM with a 16F684 ?
    By Byte_Butcher in forum General
    Replies: 7
    Last Post: - 17th January 2010, 22:18
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. PWM setting PIC16F887
    By Gevo in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th June 2008, 07:24
  4. Using PWM built in Module 16F628
    By earltyso in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th October 2007, 06:40
  5. Tidying Up PWM Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st February 2005, 00:26

Members who have read this thread : 0

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