Sinewaves using interrupts.


Results 1 to 26 of 26

Threaded View

  1. #7
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Hank, You could "time" the time it takes to enter the interupt and return. First replace the pause with a check for flag. set the flag low in the startup, then in the handler:
    • copy tmrl and tmrh to a variable (int_enter)
      set your flag
      return
    your main routine will see the flag set so then:
    • stop timer
      jump out of main routine
      grab tmrl and tmrh to a new variable (int_exit)
      display int_enter and int_exit
      reload timer
      turn timer on
      reset flag
      return to main

    This way you will have real time values for the lag in and lag out. This will be very intresting numbers so please post them. Seems like anyone dealing with stuff in time critical situations will find value in this.

    Then you can add stuff to the handler to see how much time it takes to do x,y,z. In fact, I for one am very intrested in how long the "toggle" command takes. So taking that out and running to get some base numbers, then adding it back in, we will see the differance in the int_exit value.
    Heck, Some day I may even have to do this myself. I am courious how long every command in PBP takes. I am from the ASM club. As such, I am used to being able to just count instructions to get execution times. With PBP, I have no way of knowing. Heck, even back when I was messing with BS1, they stated each instruction "cost" 200uS! thats a ton of time, but you knew what it was so you can account for it.
    Last edited by cncmachineguy; - 1st October 2010 at 11:35. Reason: added
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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