Hpwm On 16f873


Closed Thread
Results 1 to 5 of 5

Thread: Hpwm On 16f873

  1. #1
    Join Date
    Feb 2008
    Posts
    6

    Default Hpwm On 16f873

    HI.
    I'm using pbp2.46 with MCS.
    I'trying to LED dim controll.
    like bellow program,
    No complie error and ICD error.
    but, LED dose not work.
    What's wrong at this program.

    DEFINE LOADER_USED 1 ' uses a bootloader
    define OSC 20 ' *** SET THE CORRECT SPEED ***

    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 0
    DEFINE CCP2_REG PORTB
    DEFINE CCP2_BIT 1
    DEFINE CCP3_REG PORTB
    DEFINE CCP3_BIT 2

    ADCON1 = 7

    N1 var byte : N2 VAR BYTE :N3 VAR BYTE
    trisa.1 = 1
    trisa.2 = 1
    trisa.3 = 0
    trisa.0 =0
    trisb =0

    main1:
    ptn1:
    porta.3 = 0
    for N1 = 1 to 254 'ptn1

    HPWM 1,n1,1000
    HPWM 2,n1,5000
    HPWM 3,n1,5000


    if porta.2 = 1 then
    porta.3= 1
    pause 500
    goto ptn2
    else
    endif
    next N1

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by k-hirayama View Post
    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 0
    DEFINE CCP2_REG PORTB
    DEFINE CCP2_BIT 1
    DEFINE CCP3_REG PORTB
    DEFINE CCP3_BIT 2
    Look at the '873 datasheet.
    How many CCP modules does the '873 have?
    What pins are those modules assigned to?

  3. #3
    Join Date
    Feb 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Smile

    Hi
    thank you always.

    Sorry that I do not understand about ccp.
    usealy I see only about pin diagram in datasheet, so not know deeply understand about a PIC.
    873 have no ccp3, isn't it.
    a thing that I want to do is dim controll of LED to port B0-B7.

    I can't understand defnition of ccp.
    so I need sample program.

    Do realize port B0-B7 pwm controll at the same timing ?
    I know multiple pwm controll by ASM even low-end pic, but I can not do this.

    I dislike a C language like CCSC.
    pbp with MCS evironment is ideal for me. especialy the variable is seen. it's so good.

    regard.




    Quote Originally Posted by skimask View Post
    Look at the '873 datasheet.
    How many CCP modules does the '873 have?
    What pins are those modules assigned to?

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    give this a shot . . .
    http://www.microchip.com/stellent/id...cName=en010235
    My bad. it seems the links do not go anywhere . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by k-hirayama View Post
    Sorry that I do not understand about ccp.
    usealy I see only about pin diagram in datasheet, so not know deeply understand about a PIC.
    873 have no ccp3, isn't it.
    Yes, you are correct, the '873 does not have a CCP3.
    Also, the datasheet's pin diagram's in the CCP module chapter also show which pins are connected to each of the remaining 2 CCP modules.

    a thing that I want to do is dim controll of LED to port B0-B7.
    I can't understand defnition of ccp.
    so I need sample program.
    Do realize port B0-B7 pwm controll at the same timing ?
    I know multiple pwm controll by ASM even low-end pic, but I can not do this.
    There are more than a few examples (some very recent) of both software and hardware PWM control of pins on this site. All it takes is a bit of searching.

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. HPWM down
    By lerameur in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th January 2007, 00:06
  4. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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