Using INCLUDE to add a text file in PBP3


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Location
    Arizona
    Posts
    3

    Default Using INCLUDE to add a text file in PBP3

    I am attempting to include a text file in my program. The file consists of 120 rows of 5 numbers (1 - 5). It is to be used as data by the program. The idea is to use a random number the result of which will be used to determine what row to start on in the text file.

    As I read the manual, I get the impression that I am limited to .bas files.

    Anyone have a good idea how to do this?

    Thanks in advance,

    Bob.

  2. #2
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Using INCLUDE to add a text file in PBP3

    A .bas file is simply a text file that conforms to the format that picbasic expects and can compile. You can declare arrays of variables in that file that can be used in the remainder of the program.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: Using INCLUDE to add a text file in PBP3

    Arrange your values prefixed by DATA inside the INCLUDE file, load a table (refer to manual) then process it as you see fit.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default Re: Using INCLUDE to add a text file in PBP3

    But DATA stores the values in EEPROM - don't know if it matters in this case but it needs to be considered.
    The topic "Strings in codespace" has come up a couple of times, Darrel had some routines for it but his site is no longer available for apparent reasons. There's a repository somewhere on the forum, perhaps it's there. Anyway, here's the thread with the discussion around his code. There are other threads as well.

    /Henrik.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Using INCLUDE to add a text file in PBP3

    has to be 18f device, org 0x.... start location in program memory..... quotes around text, spaces have to be added with dec 34, cr is dec 13
    that is text and decimals or hex numbers placed in memory at program time, accessed starting at the org location

    END
    ''==============TABLES============= ''!!! ADD 0,0,0 TO END
    ASM
    tbl1 org 0xA400
    db "HTTP/1.0 200 OK",13,"Content-Length: 800 ",13,13
    db "<html>",13,"<h1> PIC 18F...TT Server v1.0</h1>",13,"<input type=",34,"text",34," id=",34,"txt",34,">"
    db "<script type=",34,"text/javascript",34,">" ,13," var c=0;var t;var timer_is_on=0; "
    db "function timedCount(){document.getElementById('txt').value= c;c=c+1; "
    db "t=setTimeout(",34,"timedCount()",34,",1000);}func tion doTimer(){if (!timer_is_on){timer_is_on=1;timedCount();}} "
    db "</script><form method=",34,"get",34,">Project name: <input type=",34,"text",34," name=",34,"PIC",34," value=",34,"PIC18F2525 ",34," />"
    db "<br>select one: <select><option>Amps</option> "
    db "<option>Volts</option><option>Frequency</option> </select>"
    db "<input type=",34,"submit",34," value=",34,"Submit",34," /></form> "
    db "<body onLoad=",34,"doTimer()",34,"><p><b>Note: TEXT HERE </b><br><script type=",34,"text/vbscript",34,">"
    db "document.write(NOW & ",34," Hello World!",34,")</script><br></body></p> </html> "
    db "<style type=",34,"text/css",34,">body{background-color:#d0e4fe;}h1{color:red;} style> "
    db "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>< BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR ><BR> ",0,0,0
    db "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>< BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR ><BR> ",0,0,0
    ENDASM
    '''---------------------------------------------------------------
    Last edited by amgen; - 16th May 2016 at 20:01.

Similar Threads

  1. PBP3 to include 18F97J94?
    By fowardbias in forum PBP3
    Replies: 1
    Last Post: - 18th December 2013, 17:42
  2. Include File problem
    By lerameur in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd March 2011, 18:44
  3. Can't seem to add AllDigital to the include files
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th November 2009, 05:21
  4. Include ASM file help
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd May 2007, 21:22
  5. The ultimate include file
    By bearpawz in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th January 2007, 20:35

Members who have read this thread : 0

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