Example code for capture series of pulses, using internal timers?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default Example code for capture series of pulses, using internal timers?

    Hello.

    Does anyone has some code?

    Just want to have look, how it should be done properly.

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


    Did you find this post helpful? Yes | No

    Default Re: Example code for capture series of pulses, using internal timers?

    Most hardware timers can be setup as counters with external clock input.
    Here's a snippet using TMR1 on a 16F88. (Not verified to work but should do so....)
    Code:
    TRISB.6 = 1         ' T1CKI is on RB6, make sure it's an input
    T1CON = %00000111   ' Enable TMR1 as a counter, 1:1 prescale, no sync.
    
    Main:
      LCDOUT $FE, 1, "Pulsecount: ", DEC TMR1H*256 + TMR1L
      Pause 250
    Goto Main
    /Henrik.

Similar Threads

  1. Moving on to 18F series.
    By Tina10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th September 2012, 06:50
  2. Synchronous pulses
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 18th October 2009, 17:32
  3. Counting Pulses
    By Tobias in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th September 2008, 18:35
  4. Code Problem - Strings/ LCD/ internal EEPROM
    By jorge in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 4th February 2008, 21:24
  5. Counting pulses
    By srspinho in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 19th November 2003, 01:54

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