Indexing WORD variables goes wrong after index(0) - 18F1330


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    I noticed you declared the array as WORD(100)

    and your for to loop as 0 to 100 (= 101)

    maybe 0 to 99 will make it work?

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    Rodger, Try something like this:

    declare this:
    @TIMER0 = TMR0L
    TIMER0 VAR WORD EXT

    This will treat TMR0L as a word. Then all you need to do is something like this:

    IR_Time_Data(index) = TIMER0 'READ CURRENT TIMER VALUE and place into word array by (index).
    Dave Purola,
    N8NTA
    EN82fn

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    Thanks a lot Dave.

    I'll have to dig in this "EXT" to see exactly what this does, but it (sorry: "you") actually solved my problem.

    Thank you very much again
    Roger

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    Rodger, Perhaps this thread will help:

    http://www.picbasic.co.uk/forum/showthread.php?t=3891
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    Thank you Dave.

    This is indeed very interesting and helpful (at least in my case)
    Roger

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Indexing WORD variables goes wrong after index(0) - 18F1330

    I noticed you declared the array as WORD(100)

    and your for to loop as 0 to 100 (= 101)

    maybe 0 to 99 will make it work?
    No chance here, doesn't change anything, but good observation - I missed that one
    Roger

Similar Threads

  1. writing word variables to data memory
    By malc-c in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 6th August 2010, 09:21
  2. Replies: 13
    Last Post: - 24th April 2010, 16:44
  3. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 04:35
  4. About writing word variables into the eeprom
    By Ted's in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th August 2008, 21:20
  5. Declaring word-variables in bank15 on a pic18f2431 ?
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th October 2006, 22:32

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