cycle length to do various tasks


Closed Thread
Results 1 to 5 of 5

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: cycle length to do various tasks

    I thought it might be for a servo.

    First, take a look at this program I did many years ago ...
    http://www.pbpgroup.com/modules/wfse...hp?articleid=2

    It uses a single timer for both the on and off times.

    As for the execution times for various statements, there is no one answer.
    It depends on what size the variables are, what bank the registers are in, and where in the code the statement is located.
    A statement like A = B can take anywhere from 2 to 8 assembly language instructions. Which at 4mhz would be 2 to 8uS.

    For getting in and out of the interrupt, the differences are even greater depending on the type of handler used.

    The PWPS program accounts for those times by adding the reload values to the accumulated timer values.
    It's ISR is strickly assembly language, but the same thing can be done with DT_INTS.
    DT

  2. #2
    Join Date
    Apr 2012
    Location
    Leicester UK
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: cycle length to do various tasks

    That program was an interesting read thank you. It certainly makes me think I should consider learning some assembly code, to allow me to control the number of cycles of time critical programs and also ensure that variables are saved in certain banks so the PIC does not need to spend time jumping from one bank to the other when running a critical task.

    For the time being I will stick with DT-INTS as I believe writing my own assembly level interrupt is seriously beyond me. Maybe something to try in a few years.

    I think I'll spend sometime adjusting the numbers being loaded into the various timer registers and see if I can learn some assembly code.

    Thanks for your help

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