PIC12f675 timer1 pulse width


Closed Thread
Results 1 to 2 of 2
  1. #1
    ck1223's Avatar
    ck1223 Guest

    Unhappy PIC12f675 timer1 pulse width

    I'm trying to calculate a pulse width with the rfPIC12f675 using IOC. My pulse width will range from 3ms-7ms, and so i'm aiming to detect up to 4000 different values.

    2 issues come into play.

    1. (Most important issue) Timer1 is seperated into two 8bit addresses, TMR1H and TMR1L (i believe). Where TMR1H is the upper 8bits or the timer, and TMR1L is the lower 8bits of the timer. How can I "combine" these 2 addresses so that I can subtract the rising edge time from the falling edge time?

    2. Using IOC, how can I check if the IOC went from low to high, than high to low on a specific port. I realize I can use GP2 for edge detecting setting for rise edge and falling edge, but I have 2 ports with incoming pulse widths, and thus have just decided to use IOC for both ports.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi ck1223,

    For the first issue ...
    Code:
    @TMR1 = TMR1L
    TMR1  VAR  WORD  EXT
    Now you can use the TMR1 value like any other word.

    Just be sure to turn the timer OFF when changing values. Otherwise, the lowbyte might overflow into the highbyte in-between PBP changing the separate registers.
    <br>
    DT

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 12:12
  2. Replies: 3
    Last Post: - 13th September 2008, 17:40
  3. measure pulse width 0-150Hz
    By kewetman in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th November 2007, 21:38
  4. pulse width modulation
    By cheznez in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 16th February 2005, 17:14
  5. Pulse Width Measurement
    By atomski in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 29th January 2005, 00:53

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