Announcement

Collapse
No announcement yet.

DEFINE RESET_ORG and DEC modifier issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DEFINE RESET_ORG and DEC modifier issue

    Hi all,
    In the code below I use a simple DEC modifier to output a string and it works as expected.
    But If I use "DEFINE RESET_ORG 1EC00h"
    it doesn't work and the devices seems to reset continuously.
    How is it possible ?

    Code:
     
    DEFINE OSC 8
    DEFINE HSER2_RCSTA 90H
    DEFINE HSER2_TXSTA 24H
    DEFINE HSER2_BAUD 19200
    DEFINE HSER2_CLROERR 1
    CLEAR
    OSCCON =100000 ; Primary oscillator, internal 8MHz OSCCON2.0 =1
    OSCTUNE.7 =1
    Adr VAR WORD
    loop1:
    FOR Adr=1000 TO 1005
         HSEROUT2 ["test1: ",13,10] ' -->>>> this works always         
         HSEROUT2 ["test2: ", DEC4 Adr,13,10] ' -->>>> this works only if I comment the first line "DEFINE RESET_ORG 1EC00h"
    NEXT Adr
    PAUSE 1000
    CLEARWDT
    goto loop1

  • #2
    I never tried referring to hex with an "H" suffix in PBP. I always used $1EC00. Not that I think that's your issue,...
    We can crack this cotton PIC'n thang!

    Comment


    • #3
      Hi,
      looks like that directive must be written that way. If I try with "$1Ec00" I obtain this error

      Code:
      PICBASIC PRO(TM) Compiler 3.1.3.4, (c) 1997, 2020 ME Labs, Inc.
      All Rights Reserved.
      Error[107] D:\PBP3_1\PBPPIC18.LIB 1229 : Illegal digit (E in decimal)
      Error[107] D:\PBP3_1\PBPPIC18.LIB 1229 : Illegal digit (C in decimal)
      Error[112] D:\PBP3_1\PBPPIC18.LIB 1229 : Missing operator
      Error[107] D:\PBP3_1\PBPPIC18.LIB 1229 : Illegal digit (E in decimal)
      Error[107] D:\PBP3_1\PBPPIC18.LIB 1229 : Illegal digit (C in decimal)
      Error[112] D:\PBP3_1\PBPPIC18.LIB 1229 : Missing operator

      Comment


      • #4
        Edit: I'm trying to write the address in decimal. With address below 65536 (let's say "DEFINE RESET_ORG 60000") it works, but over (let's say 65536) it fails.
        Also using PBP Long setting.

        Above 64K it works only removing the line with DEC modifier:

        Code:
         FOR Adr=1000 TO 1005
        HSEROUT2 ["test1: ",13,10] ' -->>>> this works always
        ' HSEROUT2 ["test2: ", DEC4 Adr,13,10] ' -->>>> this works only if you comment the first line "DEFINE RESET_ORG 1EC00h"
        NEXT Adr
        PAUSE 1000
        CLEARWDT
        goto loop1
        Last edited by marcick; 01-29-2021, 11:58 PM.

        Comment


        • #5
          I'm afraid this is a limitation of PBP that probably won't be changed. The library routines (assembly language for high-level commands like HSEROUT) were written with the assumption that they would be in memory below 64K. They are the first thing placed after the RESET_ORG address. When I tested a variant of your code, the maximum address that could be safely defined was 0FFE4h. That limit will move down every time you use a new high level command which triggers a library inclusion.

          I don't think this has ever come up before. Would you share some details about what you need to accomplish? If you'd rather do so in email, it's [email protected].


          Charles Leo
          ME Labs, Inc.
          http://melabs.com

          Comment


          • #6
            Thanks Charles, I'll email you and explain what I'm doing.

            Comment

            Working...
            X