Elapsed Timer findings


Results 1 to 40 of 48

Threaded View

  1. #20
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer findings

    Very similar to what I did.
    I used the Elapsed Timer to generate a 1KHz 50% duty cycle signal on PORTA.4.
    I wanted to test the stability of the Timer1 interrupt period using the Elapsed Timer code we have been discussing.

    In the ISR I used a call to the RELOAD_TIMER macro after setting the state of the pin.
    That lets the Elapsed Timer code handle things and I could check the accuracy of the output.

    I was lazy though and did not setup a variable to track the state of the pin.
    I just read the port and flipped the pin.
    This was a test and I really didn't mind if I hit the other pins on PORTA.

    500ms Timer1 ISR:
    Code:
            asm
                COMF PORTA, 0   ; 1 Tcy - Complement PORTA, Store in W
                ANDLW 10h         ; 1 Tcy - Force all PORTA pins to 0 except pin 4 
                MOVWF PORTA    ; 1 Tcy - Set the new value for PORTA
                RELOAD_TIMER    ;  Reload the timer
            endasm
    Last edited by Tabsoft; - 20th May 2015 at 16:20. Reason: Additional Info
    Regards,
    TABSoft

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. SPWM and Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th May 2008, 03:16
  3. Darrel Taylor Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th March 2008, 01:22
  4. DT Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th March 2008, 23:17

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