Yesterday 23:49
Forum: Proton Plus Compiler v3
Starter: xldaedalus
Views: 0
Replies: 11
Go to last post By: tumbleweed
Yesterday 19:54
Forum: Proton Plus Compiler v3
Starter: joesaliba
Views: 0
Replies: 4
Yesterday 18:02
Forum: Proton Studio
Starter: GAMBOA
Views: 0
Replies: 1
Yesterday 14:28
Forum: Timer Modules
Starter: See_Mos
Views: 0
Replies: 1
Yesterday 14:23
Forum: The Lounge
Starter: craig
Views: 0
Replies: 24
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,786
    Thumbs Up
    Received: 158
    Given: 153
    Total Downloaded
    3.04 GB

    0 Not allowed!

    Default Use of ORG near end of code ROM on 18F26K22

    Compiler Anomaly Report
    Reference
    Use of ORG near end of code rom on 18F26K22
    Please state the version of PDS that this report refers to
    3.6.0.3
    Does this anomaly appear in the list of Known Issues
    No
    Your forum nick name
    towlerg
    Which Operating System are you using
    Win 7 64bit
    Describe the issue
    This construction works correctly on all the usual suspect 18F's and 16F's. I suspect that it's to do with 64K ROM?

    If I place "Org (_code - 16) " and the CData bytes to the end of a program using 18F27K22 it fails with

    ERROR: The program code does not fit in the device ....
    WARNING: Program has exceeded 64K bytes of flash memory.
    WARNING: If problems occur, move any Cdata statements closer to the beginning of the ...

    The ERR file contains only the usual "Warning level superseded.." messags and a HEX file IS generated.

    Code does not appear to run.

    The CData should run from 0xFFF0 TO 0xFFFD





    k
    Submit a code example
    ' sorry it's so big, mainly setup for internal clock

    Device = 18F26K22
    Xtal = 64
    TRISA = 0

    OSCTUNE.6 = 0 ' turn off PLL for safety while we setup clock
    OSCCON = %01111000 ' Oscillator Control Register
    OSCCON2 = %00000000 ' Oscillator Control Register 2
    OSCTUNE= %11000000

    While OSCCON2.7 = 0
    DelayMS 1 ' wait a bit for the clock to stabilize
    Wend

    While 1 = 1
    Set PORTA.4
    DelayMS 500
    Clear PORTA.4
    DelayMS 500
    Wend

    ' internal clock 16MHz with 4xPLL = 64MHz
    Config_Start
    FOSC = INTIO67 ; Internal oscillator block
    PLLCFG = On ; Oscillator multiplied by 4
    PRICLKEN = On ; Primary clock enabled
    FCMEN = OFF ; Fail-Safe Clock Monitor disabled
    IESO = OFF ; Oscillator Switchover mode disabled
    PWRTEN = On ; Power up timer enabled
    BOREN = On ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
    BORV = 285 ; VBOR set to 2.85 V nominal
    WDTEN = OFF ; Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS = 32768 ; 1:32768
    CCP2MX = PORTC1 ; CCP2 input/output is multiplexed with RC1
    PBADEN = OFF ; PORTB<5:0> pins are configured as digital I/O on Reset
    CCP3MX = PORTB5 ; P3A/CCP3 input/output is multiplexed with RB5
    HFOFST = On ; HFINTOSC output and ready status are not delayed by the oscillator stable status
    T3CMX = PORTC0 ; T3CKI is on RC0
    P2BMX = PORTB5 ; P2B is on RB5
    MCLRE = INTMCLR ; RE3 input pin enabled; MCLR disabled
    STVREN = On ; Stack full/underflow will cause Reset
    LVP = OFF ; Single-Supply ICSP disabled
    XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    Debug = OFF ; Disabled
    Cp0 = OFF ; Block 0 (000800-003FFFh) not code-protected
    CP1 = OFF ; Block 1 (004000-007FFFh) not code-protected
    CP2 = OFF ; Block 2 (008000-00BFFFh) not code-protected
    CP3 = OFF ; Block 3 (00C000-00FFFFh) not code-protected
    CPB = OFF ; Boot block (000000-0007FFh) not code-protected
    CPD = OFF ; Data EEPROM not code-protected
    WRT0 = OFF ; Block 0 (000800-003FFFh) not write-protected
    WRT1 = OFF ; Block 1 (004000-007FFFh) not write-protected
    WRT2 = OFF ; Block 2 (008000-00BFFFh) not write-protected
    WRT3 = OFF ; Block 3 (00C000-00FFFFh) not write-protected
    WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF ; Boot Block (000000-0007FFh) not write-protected
    WRTD = OFF ; Data EEPROM not write-protected
    EBTR0 = OFF ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
    EBTR1 = OFF ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
    EBTR2 = OFF ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
    EBTR3 = OFF ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
    EBTRB = OFF ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End

    Org (_code - 16)
    HexTag: CData $0, $0, $0, $0, $0, $0, $0, $0, $0, $0, $0, $0, $55, $CC ' 14 bytes
    Have you identified a work around
    No
    Work around description
    -

  2. #2
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    654
    Thumbs Up
    Received: 121
    Given: 2
    Total Downloaded
    3.33 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code rom on 18F26K22

    This issue has been discussed previously in the forum. The compiler always writes a STOP after the last line of .bas code. So if you do not leave enough space in the ROM memory to write the While: Wend code, an error is generated when compiling.
    Try Org (_code - 18) and the code works.
    [U]73's de Alberto ea3agv[/U]

  3. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,786
    Thumbs Up
    Received: 158
    Given: 153
    Total Downloaded
    3.04 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code rom on 18F26K22

    Alberto, I'm embarrassed to say I was involved in that disscussion and completly forgot it. Sorry to anyone who wasted time reading this thread.
    George

  4. #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,786
    Thumbs Up
    Received: 158
    Given: 153
    Total Downloaded
    3.04 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code rom on 18F26K22

    This realy is a perfect example of seeing what you expect rather than see what's there. I expected to have a problem with a device that completly filled the 16bit ROM space and as soon as I had what seemed like a problem in that area, I cried wolf. According to my friend Google, it called confirmation bias.
    George

  5. #5
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,537
    Thumbs Up
    Received: 103
    Given: 29
    Total Downloaded
    2.60 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code rom on 18F26K22

    Here's another example from another thread re $MID.

    The following does a $mid function and I spent hours looking for a fault here and elsewhere.

    Code:
    GetMid:                                 ' effectively a MID$ routine with X, Y providing the bounds.
         Z = 0
         For Count1 = X To Y
            DestinStr[Z]= StringIn[X]
            Inc Z
         Next
    Return
    obviously it should have been:
    Code:
    GetMid:                                 ' effectively a MID$ routine
         Z = 0
         For Count1 = X To Y
             DestinStr[Z]= StringIn[Count1]
             Inc Z
         Next
    Return
    And they were arrays not strings (mistake 1 - see $MID thread) and the loop variable was 'count1' not 'X' (mistake 2). I just looked over the same error a dozen times.
    Talk about blind to obvious things !

    No wonder I have so many compiles.
    John

  6. #6
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,537
    Thumbs Up
    Received: 103
    Given: 29
    Total Downloaded
    2.60 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code ROM on 18F26K22

    George/Charlie,
    I've moved the posts out of anomaly reports.
    John

  7. #7
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,346
    Thumbs Up
    Received: 83
    Given: 23
    Total Downloaded
    3.86 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code ROM on 18F26K22

    As John moved the thread outside the anomaly reports I have a question please.

    What does Org (_code - 18) do?

    It places software to last sentence of code (_code) - 18?
    Regards

    Joseph

  8. #8
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,786
    Thumbs Up
    Received: 158
    Given: 153
    Total Downloaded
    3.04 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code ROM on 18F26K22

    Not sure is I understand the question especially as you provide a perfectly good answer yourself.

    If you are asking why I use that construct, it allows me to add compilaition time/date, compiler version, application version and automatically incrementing serial number to the code image, in such a way that it can be both human an PIC device readable on any PIC device that can read it's own code ROM.
    George

  9. #9
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,346
    Thumbs Up
    Received: 83
    Given: 23
    Total Downloaded
    3.86 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code ROM on 18F26K22

    George,

    Looking something to use as an EEPROM. Have a look at this thread please.
    Regards

    Joseph

  10. #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,786
    Thumbs Up
    Received: 158
    Given: 153
    Total Downloaded
    3.04 GB

    0 Not allowed!

    Default Re: Use of ORG near end of code ROM on 18F26K22

    Joe, I don't do anything in any way clever, I just sit in a loop CReading

    D_Counter = 16
    While D_Counter > 2
    D_Data = CRead (_code - D_Counter)
    GoSub D_SendByteAndUpCRC
    Dec D_Counter
    Wend

    Code is slightly complicated by the fact that it needs to access the last 14 bytes across a range of devices with different ROM sizes. I've never tried but I assume CRead works in a similar fashion.

    You should look at CRead16 for words.
    George

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Replacement CD-ROM
    By mmayrene in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 21st November 2011, 17:18
  2. DS1820 Reading the 64 bit rom code
    By SimonJA in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 1st April 2006, 14:23
  3. org 0x0000 and org 0x0008
    By Hans Chr in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 20th April 2005, 21:12

Members who have read this thread since 15th October 2018, 11:31 : 0

Actions :  (Set Date)  (Clear Date)

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