Can i use timer1 as a counter while using it by HPWM


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2006
    Posts
    21

    Default Can i use timer1 as a counter while using it by HPWM

    Dear friends ...

    I am making a code which generates a hardware pulse width modultaed frequency (HPWM) using HPWM command as follows :
    HPWM 1,210,1340
    then i want to measure time between ultrasonic signal transmission and receiving it again to measure distance ....
    the problem is that i knew that hpwm uses timer1 and i am intending to use it for measuring time , Can this be done ? or there will be an conflict in operating timer1 for hpwm and as a time counter.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Actually, the datasheet (16F877), table 8-1 as well as figure 8-3 shows that the PWM generation uses TMR2, not TMR1. It DOES use the CPP1 module though but feel free to use TMR1 as you wish. You can use CPP1 for HPWM and CCP2 for capture/compare if that's what you want.

    Note, this MAY be different on other PIC's but since you didn't say which one you're using a took the F877 as an example.

    Hope it helps.
    /Henrik Olsson.

  3. #3
    Join Date
    Dec 2006
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Many thanks

    Many thanks ... It seems that i was confused by the define
    statement explained in the pic basic pro compiler manual
    which showed defines to choose either timer1 or 2 for channel 2 or 3 in the pic17fxx series while i am using pic16f877a ... Many thanks for your concern .

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Replies: 14
    Last Post: - 26th September 2007, 05:41
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  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 : 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