Weird problem with large(ish) array access


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,656


    Did you find this post helpful? Yes | No

    Default Re: Weird problem with large(ish) array access

    another thought, on the non long version
    if you load up another 30 or so cells in buffer with 00 or ff do problems recur
    [surely its not just 01 or 0x69 that causes issue]
    Warning I'm not a teacher

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: Weird problem with large(ish) array access

    The plot thickens...

    Long stort short, flashed the device with the PICKit3, could not reproduce the error. Reflashed the bootloader into it and now I can no longer reproduce the error at will - even my ACTUAL code now works without that magic PAUSE 5 in there.

    Before doing that I had reduced the test code to this:
    Code:
    Main:
        IF INTCON.2 = 1 THEN        ' TMR0 interrupt flag? 
            LD2 = ~LD2              ' Toggle LED so we know we're alive and kickin'
            INTCON.2 = 0
        ENDIF
    
        If BTN1 = 0 THEN
    '        Buffer[107] = $00       ' Testcase with LONGs
            Buffer[117] = $00       ' Testcase without LONGs
            WHILE BTN1 = 0 : WEND
        ENDIF
        
        IF BTN2 = 0 THEN
    '        Pause 5
    '        Buffer[108] = $00       ' Testcase with LONGs
            Buffer[118] = $00       ' Testcase without LONGs       
            WHILE BTN2 = 0 :WEND
        ENDIF
    
    Goto Main
    As soon as the code for BTN2 was executed it crashed while the code for BTN1 worked fine. Enabling the PAUSE 5 made it work. And the value being written made no difference.

    As for the question if bootloaders are worth it I'd say maby. In this particular case I'm juggling two boards but I only have one PICKit so swapping between boards would be less than ideal. The USB bootloader is super fast but makes up for that by forcing you to manually reset the device and press connect in the PC application before the bootloader times out.

    Strange one this.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Weird problem with large(ish) array access

    how about contact bounce on button switches ?

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,656


    Did you find this post helpful? Yes | No

    Default Re: Weird problem with large(ish) array access

    the only thing i can think of it to verify the flash as written by the bootloader is set the way it was intended to be.
    Warning I'm not a teacher

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,144


    Did you find this post helpful? Yes | No

    Default Re: Weird problem with large(ish) array access

    Can you test the program on different kind of PIC?

    Also, without bootloader, it works OK without the magic PAUSE 5 line?

    It does seem a RAM problem related to LONGs but Charles may help more.

    Ioannis

Similar Threads

  1. Array variable access time
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2020, 07:48
  2. Replies: 9
    Last Post: - 14th September 2014, 19:38
  3. Weird Problem
    By isaac in forum General
    Replies: 9
    Last Post: - 22nd September 2008, 19:30
  4. Access array in PBP and .asm
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th September 2008, 00:35
  5. Large-ish PCB order...others wanted...
    By skimask in forum Off Topic
    Replies: 0
    Last Post: - 16th June 2006, 02:43

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