+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2008
    Posts
    85

    Default Open aninclude file

    HI ALL,

    I CANNOT OPEN FILE INCLUDE IN THE PROGRAM, SOME HELP I DO APPRICIATE
    THECODE IS COPIED FROM DARREL'S PAGE

    I.E:

    DATA_READ VAR BYTE
    DATATABLE CON EXT
    ORIGIN VAR word

    GOTO main;V SKIP THE NEXT LINES

    ASM
    DATATABLE
    INCLUDE "HELLO.asm" ; THIS IS THE EXTERNAL DATA TABLE
    end
    endasm
    '--------------------------------------
    main:

    b0 = 0

    ORIGIN = 1 ; FIRST DATA IN THE EXTERNAL TABLE

    readcode (datatable + origin), DATA_READ; READ DATA FROM THE EXTERANL TABLE

    origin = origin +1; CONTINUE READING UBTIL THE END OF TABLE....

    GOTO MAIN

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,816

    Default Re: Open aninclude file

    Include files must be in the same directory as the code you have written.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191

    Default Re: Open an include file

    Include file can be also in different folder, but then you must define the path.

    Example:
    [HTML].
    .\PBP_code <- Your PBP file is located here
    .\include <- Your include file is located here[/HTML]
    Code:
    <code><font color="#000000"><b>INCLUDE </b><font color="#FF0000">&quot;..\include\HELLO.asm&quot;</font></code>

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,193

    Default Re: Open aninclude file

    Or in the root of the PBP install folder. In which case you don't have to specify any path etc, just the filename.

    It's my understanding that the compiler starts looking in the same folder as the source file. If the specified file isn't found there it then looks in the PBP install folder.

    /Henrik.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,816

    Default Re: Open aninclude file

    . . . and then I continue to learn . . . so much for repeating the Party Line
    Henrik, That Makes sense . . . Gusse, it looks as if you have shown a truncated path statement, is there a way to set a PATH in code or in an .ini file somewhere so PBP will automatically seek out the include statements other than in the root or source file directories? I like Gusse's method of having a folder named include, a good place for all of Darrel's hard work, but using Windoze directories the path gets a bit long esp. if you accept "Default" installation parameters. I suppose I could put that include directory in the Root of C: and the path would be short.
    Maybe DEFINE path=c:\PBP\code;C:\pbp\include; . . . .
    Last edited by Archangel; - 24th March 2011 at 18:36. Reason: add
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191

    Default Re: Open aninclude file

    Actually, I like this include so much that all of my codes are using following structure. This way it is very much easier to do improvement or modification to some specific parts and leave working code untouchable.

    Example of master code line:

    Code:
    <code><font color="#000080"><i>'----------------------------------------------
    ' XXX with PIC18F4520 and Nokia 3310 display                                                 
    '----------------------------------------------
    ' Include &amp; Definition section 
    '----------------------------------------------  
    
    '----- Basics ---------------------------------
    </i></font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\Definitions.pbp&quot; 
    </font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\Variables.pbp&quot;
    
    </font><font color="#000080"><i>'----- LCD Selections -------------------------
    </i></font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\LCD_5V.pbp&quot;
    
    </font><font color="#000080"><i>'----- Inits and ADC Definitions --------------
    </i></font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\Inits.pbp&quot;
    </font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\ADCIN.pbp&quot;
    
    </font><b>DEFINE </b>OSC 32 
    
    <font color="#000080"><i>'----------------------------------------------
    ' Main program  
    '----------------------------------------------
    </i></font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\Mainloop.pbp&quot;
    
    </font><font color="#000080"><i>'----- LCD Setups -----------------------------               
    </i></font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\LCD_3310.pbp&quot;             
    </font><b>INCLUDE </b><font color="#FF0000">&quot;..\incl\Display_Refresh_3310.pbp&quot;
    <font color="#000080"><i>'----------------------------------------------</font></code>
    Last edited by Gusse; - 24th March 2011 at 22:01.

  7. #7
    Join Date
    Apr 2008
    Posts
    85

    Default Re: Open aninclude file

    hello all,
    thanks for your help.

    i try to add directory of the file, : it still do not open
    include "c:\user\minhle....\hello.asm"

    and even copy the file into directory of PBP (where .inc is ) the compiler show up huge errors.

    note that i do not run INTERRUPT in the program. and the simple program is to open included file only

  8. #8
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191

    Default Re: Open aninclude file

    Remove ASM and ENDASM.

    "The ASM and ENDASM instructions tells PBP that the code between these
    two lines is in assembly language and should not be interpreted as
    PICBASIC PRO statements. You can use these two instructions to mix
    assembly language code with BASIC statements."

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