syntax error


Closed Thread
Results 1 to 19 of 19

Thread: syntax error

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest

    Default syntax error

    Hi,

    I'm trying to use 4 pots to provide a range of values to set the temperature set point in the code featured http://www.picbasic.co.uk/forum/showthread.php?t=12712

    When I use the following code I get a bad expression syntax error on the SetPoint(ADchan) = POTS(ADchan) line

    Code:
        FOR ADchan = 0 to 3
            GOSUB GetADC
            POTS(ADchan) = ADvalue
            SetPoint(ADchan) = POTS(ADchan)
        NEXT ADchan
    My logic seems that it gets the adc value, places that in the POTS(0), POTS(1) etc, and then should give SetPoint(0) the same value as POTS(0)

    All I really need is a range between 100 and 500 for each SetPoint

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    Hi,

    I'm trying to use 4 pots to provide a range of values to set the temperature set point in the code featured http://www.picbasic.co.uk/forum/showthread.php?t=12712

    When I use the following code I get a bad expression syntax error on the SetPoint(ADchan) = POTS(ADchan) line

    Code:
        FOR ADchan = 0 to 3
            GOSUB GetADC
            POTS(ADchan) = ADvalue
            SetPoint(ADchan) = POTS(ADchan)
        NEXT ADchan
    My logic seems that it gets the adc value, places that in the POTS(0), POTS(1) etc, and then should give SetPoint(0) the same value as POTS(0)

    All I really need is a range between 100 and 500 for each SetPoint
    Have you tried [square] brackets ?
    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
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Malc,

    Use ...

    Setpoints(ADchan)
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Hi Malc,

    Use ...

    Setpoints(ADchan)
    <br>
    Hmmm . . . so (ADchan) is a MATH operation ? I thought it was an array, if it is, then (brackets) are OK ?
    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.

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Hi Malc,

    Use ...

    Setpoints(ADchan)
    <br>

    How the hell did I miss that !

    Now just got to work out how to get the value with in the range !

    Thanks once again Darrel

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    How the hell did I miss that !

    Now just got to work out how to get the value with in the range !

    Thanks once again Darrel
    Hi Malc, I would say pretty darn easy, given the size of this program, I just un zipped it, nice work ! To all involved.
    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.

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks, but really the credit for the coding goes to Darrel.

    I'm still a rookie in PBP, and it's taking me hours to try and work this out and I'm still having trouble getting the value from the pot to change the set temperature

Similar Threads

  1. Compile error & syntax error on the word "loop:" as a label?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2010, 04:14
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 04:58
  4. 16F88 Compile error
    By Toley00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2005, 00:22
  5. Syntax error PIC16F684
    By milestag in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st September 2005, 18:54

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