syntax error


Closed Thread
Results 1 to 19 of 19

Thread: syntax error

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Cheers DT !

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


    Did you find this post helpful? Yes | No

    Default Porting from 16F to 18F - strange A/D

    Guys,

    Is A/D handled different in an 18F4550 to a 16F877A ?

    The development of the 4ch PID thermostat with Darrel got as far as porting the original code to a 18F4550 (mainly as it has a lot more code space). I've copied over the A/D from the 16F code

    Code:
    ;----[Analog Settings]------------------------------------------------------
    DEFINE ADC_BITS 10                ' Set-up ADC for fastest 10-bit results
    DEFINE ADC_CLOCK 2
    DEFINE ADC_SAMPLEUS 5
    INCLUDE "DT_Analog.pbp"
    
    MaxSetPoint  CON 350              ' Pot fully clockwise
    MinSetPoint  CON 100              ' Pot fully counter clockwise 
    ADbits = 14                       ' set A/D resolution to 14-bits
    CMCON = 7                         ' disable Comparators
    ADCON1 = %10000010                ' AN0-4 Analog, Right justify
    ADCON1 = $0F
    And have the same routine for using the value to set the set point
    Code:
    GetSetpoint:
        FOR ADchan = 0 to 3
        GOSUB GetADC
        Result  = ADvalue*(MaxSetPoint - MinSetPoint)
       Result  = (DIV32 ADmax) + MinSetPoint
        Setpoints(ADchan) = Result 
        NEXT ADchan
    But when viewed on the PC via Hyperterminal the set point is either 10 or 110.

    I've tried changing the two values for minsetpoint and maxsetpoint to no avail.

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