table of constant


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    detonator's Avatar
    detonator Guest

    Default table of constant

    Sorry I have a stupid question about syntax,
    how can I implement table of constants (lot of constants) into picBasic code?
    thank you.

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Detonator,

    First, the constants you declare in Pic Basic are only used during during the assembly process to create the code. In the code that is loaded into the pic, there is just the number.

    Now, There are a number of ways to do what it sounds like you want to do. Here are 2:

    1) Using the LOOKUP or LOOKUP2 commands
    2) Saving your data into the EEPROM or an Unused portion of Program Memory as a lookup table. Then you can lookup the data in the table based on whatever you need. Read up and then search the forum on the following PBP commands: EEPROM, DATA, READ, WRITE also READCODE, WRITECODE, ERASECODE. You might also want to read Darrel Taylor's work on storing strings into program memory. It may be useful if your data is 7 bits or less (as well as this thread on Embedded Strings in your Code Space).

    Just a couple of ideas to get you started. Have a look and get back with some more specifics. (Do a little homework on your own and you will likely get a lot of help here working out the details/bugs)

    Steve

  3. #3
    detonator's Avatar
    detonator Guest


    Did you find this post helpful? Yes | No

    Default

    thank you Steve,
    I meant somethink like DT or RETLW in assembler
    so I'll do this part of program in assembler

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    This one might be more applicable to storing large tables of word constants.

    Using EXT with Labels ...
    http://www.picbasic.co.uk/forum/show...php?t=3891#LAB
    <br>
    DT

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  3. PIC 18F452 Table Pointer/ Table Read
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th March 2006, 03:07
  4. Writing to a table.
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th December 2005, 16:20
  5. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17

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