Today 13:19
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 12
Today 13:10
Forum: Test Postings
Starter: IstvanK
Views: 0
Replies: 0
Today 09:36
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 1
Today 00:59
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 21
Yesterday 18:41
Forum: Absolute Beginners Section
Starter: KevinPBaker
Views: 0
Replies: 5
+ Reply to Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Problem with heap directive97 days old

  1. #1
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Problem with heap directive

    Problem with heap directive with PDS version 3.6.0.1

    Hi Les,
    I was using the Heap directive because it was already written in the GPS.inc library. Everything worked well with Version 3.5.9.9 of the PDS.

    Code:
    GPS.inc
        Dim GPS_bDataString As String * 20 Heap         ' Temporary string
        Dim GPS_bRxBuffer[84] As Byte Heap              ' Holds the received characters from the GPS module
    
    Mi file: GPS_WDG_ZX4120.Inc 
        Dim GPS_bDataString As String * 25 Heap
        Dim GPS_ggaRxBuffer[85] As Byte Heap
        Dim GPS_gsaRxBuffer[90] As Byte Heap
        Dim GPS_gsv1RxBuffer[90] As Byte Heap
        Dim GPS_gsv2RxBuffer[90] As Byte Heap
        Dim GPS_gsv3RxBuffer[90] As Byte Heap
        Dim GPS_rmcRxBuffer[90] As Byte Heap   
        Dim GPS_vtgRxBuffer[90] As Byte Heap
    But with the new version 3.6.0.1 of the PDS the address of the arrays overlap with previous variables and also variables after the arrays do the same. Of course if I remove the Heap directive everything returns to normal.
    Regars
    Alberto
    GPS_Shield_DemoError.zip
    Last edited by AlbertoFS; 14th August 2017 at 14:24.
    [U]73's de Alberto ea3agv[/U]

  2. #2
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,122
    Thumbs Up
    Received: 66
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    Heap directive is new to me - couldn't find it in the manual. Is this another of the undocumented features?
    How is it used and does it apply to Proton24?
    JohnB

  3. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,327
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    Me neither. Les, what a bugger, you finally got to the bottom of the AT thing and now other memory management issues.

    Heap is used in quite a few samples.

    Anybody have the time to explain what it does?
    Last edited by towlerg; 14th August 2017 at 14:59.
    George

  4. #4
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!
    [U]73's de Alberto ea3agv[/U]

  5. #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,327
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    Well that's embarrassing.
    George

  6. #6
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    Another problem: The Warning for using too much System Variables are not running well at compile time.
    #define _SYSTEM_VARIABLE_COUNT 111

    For the PIC18F25K20 I think there are 96.

    I have another problem with indexing High Bank using more than 900 variables.
    The code works well with PDS 3.5.9.9 and I tried to work with only one routine and its variables in the lower banks. The code runs well too wit PDS 3.6.0.1.

    Since this morning I do not find the problem.
    Alberto
    [U]73's de Alberto ea3agv[/U]

  7. #7
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    I have preserved only the routine that fails in a test program. I have found the position when it fails, by moving the addresses of the variables. I do not see any indexing error of variables ...
    The code is at your disposal.
    [U]73's de Alberto ea3agv[/U]

  8. #8
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    I think I found the problem.

    There is an error of Bank switching here.
    Code:
        If qT1 <> 0 Or qT2 <> 0 Then
            If qT1 > qT2 Then 
                qTemp1 = ATan(qT2/qT1)
                qTH = PIby2 - qTemp1
            EndIf    
            If qT1 <= qT2 Then qTH = ATan(qT1/qT2)
            If qCO <0 Then qTH = PI - qTH
            If qSI <0 Then qTH = -qTH 
        Else
            qTH = PIby2 
        EndIf
        Return
    As I do not like this structure, I change it this way.
    Code:
        If qT1 <> 0 Or qT2 <> 0 Then
            If qT1 > qT2 Then 
                qTemp1 = ATan(qT2/qT1)
                qTH = PIby2 - qTemp1
            EndIf    
            If qT1 <= qT2 Then
                qTH = ATan(qT1/qT2)
            EndIf
            If qCO < 0 Then
                qTH = PI - qTH
            EndIf
            If qSI < 0 Then
                qTH = -qTH
            EndIf 
        Else
            qTH = PIby2 
        EndIf      
        Return
    But The fault is still here.
    Code:
            If qSI < 0 Then
                qTH = -qTH
            EndIf 
        Else
            qTH = PIby2 
        EndIf      
        Return
    The asm code:

    The variable qTH is Float. The lower part (qTH) is in Bank1, the others part in Bank2.
    Code:
      qTH = 255
      qTHH = 256
      qTHHH = 257
      qTHHHH = 258
    Code:
    _LBL__11
    F1_000109 equ $ ; IN [GPS_DIST_PROTEUS.BAS] IF QSI < 0 THEN
        movf qSIH,W,1
        btfss WREG,7,0
        bra _LBL__13
    F1_000111 equ $ ; IN [GPS_DIST_PROTEUS.BAS] QTH = -QTH
        btg qTHH,7,1    ; NO BANK SWITCHING
    F1_000112 equ $ ; IN [GPS_DIST_PROTEUS.BAS] ENDIF
    _LBL__13
        bra _LBL__14
    _LBL__5
    F1_000113 equ $ ; IN [GPS_DIST_PROTEUS.BAS] ELSE
    F1_000114 equ $ ; IN [GPS_DIST_PROTEUS.BAS] QTH = PIBY2
        movlw 219
        movlb 1
        movwf qTHHHH,1
        movlw 15
        movwf qTHHH,1
        movlw 73
        movwf qTHH,1
        movlw 127
        movlb 0
        movwf qTH,1
    F1_000115 equ $ ; IN [GPS_DIST_PROTEUS.BAS] ENDIF
    _LBL__14
    F1_000117 equ $ ; IN [GPS_DIST_PROTEUS.BAS] RETURN
    ; NO BANK SWITCHING
        return 0
    As it is a heavier work to modify the asm and use the MPLAB, then I do the following.
    Code:
            If qSI < 0 Then
                Movlb 1    ' Bank1
                qTH = -qTH
            EndIf 
        Else
            qTH = PIby2 
        EndIf      
        Movlb 0           ' Bank0
        Return
    And the code is running well. I hope my deduction is correct to resolve this error.
    Alberto

    Ps: OK, I have time to edit the post.
    In my large program all variables of the fault routine are in Bank3, then the fault is the same.
    Code:
            If qCO <0 Then
                qTH = PI - qTH
            EndIf
            If qSI < 0 Then
                Movlb 3
                qTH = -qTH
            EndIf 
        Else
            qTH = PIby2 
        EndIf       
        Movlb 0
        Return
    And the code works well.
    Last edited by AlbertoFS; 15th August 2017 at 08:59.
    [U]73's de Alberto ea3agv[/U]

  9. #9
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    583
    Thumbs Up
    Received: 76
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    It seems that the error is occurring in all float variables in this condition.
    FloatVariable = -FloatVariable
    [U]73's de Alberto ea3agv[/U]

  10. #10
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,620
    Thumbs Up
    Received: 59
    Given: 18
    Total Downloaded
    2.27 GB

    0 Not allowed!

    Default Re: Problem with heap directive

    Using 18F26K22.

    Have some float variables in a code, but I can confirm that a code running under 3.5.9.9 now would not run in 3.6.0.1. Although I do have a FloatVariable = -FloatVariable, commenting it out code still does not work. I loaded a hex file which was compiled with 3.5.9.9 and code worked ok.
    Regards

    Joseph

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. What does Heap mean after dimensioning a variable?
    By towlerg in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 11th February 2013, 10:27
  2. New CONFIG_START Directive
    By Paul Shepard in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 26th February 2006, 12:01

Members who have read this thread : 46

Actions :  (Set Date)

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts