Looping Variable Assignments


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    5

    Default Looping Variable Assignments

    Hi,

    I am building an application that reads an analog signal from one of the adc pins and then saves it to a progressively different variable. I want this action to be looped so I can do it 50 or so times before coming out of the loop. So my question is is their any way of incrementally changing the ram byte address each time the loop comes around or do I have to spell out each variable address (b0,b2,b3…) in my code. I know this is posable if I do this for sending the data to the eeprom but I don't want to slow down the process. Also is it true that the picbasic compiler can only access 96 bytes of ram? I want to take advantage of the PIC16F688 256B of ram. Thanks in advance.

    -Jacob B.

  2. #2
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Read in the manual or Help file about arrays. They will do what you want.

  3. #3
    Join Date
    Jul 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    But is their any way of doing this without the pro version, and are you limited to the amount of variables in either version?

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I can't give an authoratative answer (for RAM usage) for the standard PICBasic Compiler (PBC) as I don't use it, but the Pro is constrained only by the limits of the PIC you are using. I have applications with hundreds of variables working just fine. For PBC consult the product specifications, or even send MeLabs an email directly.

    As tenaja suggested, use an array. I use just this method for taking multiple sequential ADC readings, and I'm sure you will find suitable examples posted on the forum. The ADC on a 40MHz PIC is fast enough to capture Audio (not exactly Hi-Fi but it does work) - but you have to send it to external Memory as the internal EEPROM is way too slow.

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16
  5. Storing a variable in EEPROM
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th October 2005, 13:53

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