Delay without using pause - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 43 of 43
  1. #41
    Join Date
    Oct 2014
    Location
    Lagos Nigeria
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Delay without using pause

    Quote Originally Posted by amgen View Post
    I can suggest a little different approach which I have used...... its similar to how operating systems work ... and since you are using interrupts, you already are doing most of the work...
    I will explain more unless your intent on proceeding with what you have been doing.
    don
    hi amgen, pls any suggestions you have is welcome. my aim was to let you guys understand what i'm trying to do; i am not good at coding so that is where i need help: how best to go about it to get the expected results... i will be glad if you would explain

  2. #42


    Did you find this post helpful? Yes | No

    Default Re: Delay without using pause

    before adding your code, set up a real time loop with interrupt every 100 milliseconds (that gives 10 times per second and allows for many microsecond instructions to run within main timing loop) don't use any pauses....just set/start/check counters in loop sections as each pass is exactly .1 seconds.
    So program runs main loop including your individual code parts..... then waits at the bottom in a while command until the interrupt sends it back to main loop ......
    as long as all your code operates within 100 milliseconds (that's many 1 and 2 microsecond machine code instructions) then the loop will always wait until retriggered after looping through your code in the while loop.
    You set up a few flag type bits or bytes that get set/reset/checked for program flow.
    sorry if explanation is messy.
    First get the main .1 second loop working (blink/toggle an led as an indicator) then add in your code relying on the .1 second looping time.


    http://www.picbasic.co.uk/forum/asse...1&d=1311957346
    Attached Images Attached Images  

  3. #43
    Join Date
    Oct 2014
    Location
    Lagos Nigeria
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Delay without using pause

    Thanks so much amgen, i want to give this a try, looks much simpler. i am trying to convert the flowchart you posted to code, i will let u know how it turns out.

    i will see if my original trial will even compile at all :-), then i will make comparisms

    i want to be able to write more efficient code. one nice tool that has helped me to compare execution times of various methods of coding is DARREL TAYLOR's instruction time calculation code...

Similar Threads

  1. Replies: 6
    Last Post: - 28th October 2014, 06:08
  2. Do I need a pause?
    By tazntex in forum Serial
    Replies: 21
    Last Post: - 29th August 2008, 04:32
  3. 1 us delay
    By Pedro in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th February 2006, 17:28
  4. Pause
    By blue in forum General
    Replies: 7
    Last Post: - 29th December 2005, 14:24
  5. pause 0.5
    By detail in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th June 2005, 11:32

Members who have read this thread : 3

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