Execution time in programme


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59

    Default Execution time in programme

    At the risk of looking stupid, please put me out of my misery and tell me what I'm not understanding. The following snippet of code is from a lap counter feeding a 7 segment display driver.

    start_loop:
    if stpin = 1 then
    goto start_loop
    endif

    main_loop:
    IF tkpin = 1 THEN GOTO main_loop
    pause 25
    cntr = cntr + 1
    PULSOUT CLK, 500
    if cntr = laps then
    PULSOUT TIMER_EN, 5000
    END
    ELSE
    goto wait_TKloop
    endif

    Laps are set earlier in the programme, say 10. When the 10th lap is signalled via TKPIN going low then the signal is debounced, counter incremented by one, a clock pulse sent forward to the next circuit and on the 10th lap the LAPS and CNTR are equal so a final stop signal is flagged and the programme ends. I have scoped the time delay between receiving the TKPIN pulse and the falling edge Pulsout at TIMER_EN. It is always TWICE the debounce time PAUSE plus a couple of mSecs. In the example shown it is 53mS. Why twice? I expected to see about 27mS. Why is this looping twice. I guess this is stupidly easy but I've gone dumb.
    Adrian

  2. #2
    Join Date
    May 2007
    Location
    Suffolk, UK
    Posts
    59


    Did you find this post helpful? Yes | No

    Default OK found it!!

    Got it! I had a DEFINE OSC 8 line in the programme with a 4Mhz resonator! Duh!! Only taken me about 4 hours to find.....!!

    Adrian

Similar Threads

  1. Code execution time?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th February 2009, 16:07
  2. Code snippet: time execution for each line: help please
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th April 2008, 15:46
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Command execution time
    By barkerben in forum General
    Replies: 2
    Last Post: - 7th December 2004, 20:29
  5. instruction execution time
    By tjg in forum Code Examples
    Replies: 3
    Last Post: - 21st April 2004, 18:15

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