WORD bug


Results 1 to 7 of 7

Thread: WORD bug

Threaded View

  1. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Sorry, but I still do not understand why you think this is a bug?

    With the PIC operating at 8MHz, you have an execution speed of 2 million single cycle instructions per second. That's fast..!

    If you increment decideInterval on each pass through your loop, of course it will = 600 at some point. And very quickly.

    Here's another example;
    Code:
    init:
          decideInterval  var  WORD
          TIMEINTERVAL	  con  600
          decideInterval = 0
    
    main:
          decideInterval = decideInterval + 1
          IF decideInterval = TIMEINTERVAL then
              decideInterval = 0
              GOTO Match
          ENDIF
          GOTO  MAIN
    
    Match: ' End up here in approximately 11.4mS
          GOTO Match
    	
    		END
    From Main, through the loop once, then back to Main at 8MHz only takes around 19uS. Now take 19uS * 600 for ~11.4mS.

    It takes only ~11.4mS before you increment decideInterval from 0 to 600, and then the IF/THEN statement evaluates as TRUE, and program flow jumps to Match.

    Note: I verified this (PBP v2.46). It does not jump to match at 11. Only once
    decideInterval = 600.
    Last edited by Bruce; - 11th August 2005 at 16:37.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 02:51
  2. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 08:25
  3. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 12:20
  4. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th July 2008, 00:19
  5. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 16:23

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