help about error messages


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2012
    Posts
    3

    Default help about error messages

    Hello
    i'm just approaching to pic programming and i tried to compile a .bas file. Compiler give me a lot of error such as

    C:\PBP\16F684.BAS ERROR Line 135: Bad expression.
    C:\PBP\16F684.BAS ERROR Line 155: Redefiniton of LABEL CCP1CON.
    C:\PBP\16F684.BAS ERROR Line 157: Redefiniton of LABEL CCP1CON.
    C:\PBP\16F684.BAS ERROR Line 166: Redefiniton of LABEL CCP1CON.
    C:\PBP\16F684.BAS ERROR Line 168: Redefiniton of LABEL CCP1CON.

    pic is 16f684

    could someone help me to understand the error meaning, or is there a manual or other where i can study the meaning of error?
    Thanks
    Alezz.
    Last edited by fourtech; - 19th February 2012 at 08:36.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Hi, Fourtech

    Could you provide the full program you've written ???

    This is the minimum requirement for the crystal ball to light up ...

    seriously, looks to be a small typo somewhere ...

    ALAIN
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Yes, likely a typo in line 135 but could be elsewhere

  4. #4
    Join Date
    Jan 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    following the code that i tried to compile


    DEFINE OSC 8
    '************************************************* ************
    '************************************************* ************
    '******************** DEFINE CONSTANTS ***********************
    '************************************************* ************
    '************************************************* ************
    mtheader CON 2400
    mtbit0 CON 600
    mtbit1 CON 1200
    mtspace CON 600

    '************************************************* ************
    '************************************************* ************
    '******************** DEFINE VARIABLES ***********************
    '************************************************* ************
    '************************************************* ************

    bit_counter VAR BYTE
    checksum VAR BYTE
    databyte VAR BYTE
    temp VAR BYTE
    blast_ID VAR BYTE
    temp2 VAR BYTE


    '************************************************* ************
    '************************************************* ************
    '******************** PIN ASSIGNMENTS ************************
    '************************************************* ************
    '************************************************* ************
    Symbol trigger = PORTA.0 'Trigger button
    Symbol mod_out = PORTC.5 'IR mod output (40KHz) / PWM out
    Symbol tone = PORTA.5 'Piezo indicator, pin

    '************************************************* ************
    '************************************************* ************
    '******************** INITIALIZATION *************************
    '************************************************* ************
    '************************************************* ************
    initialize:
    CLEAR
    OSCCON = %01111000
    CMCON0 = 7 'turn off comparators
    ANSEL = 0

    PR2 = 49 'PWM Period (40K=49, 56K=35) (35 to 55)
    CCPR1L = 15 'PWM Duty Cycle (1 to 15)
    T2CON = 4 'Timer2 = ON; Prescale = 1:1
    CCP1CON = 0 'PWM module off
    OPTION_REG = %01111111 'Turn PortA weak pull-ups

    TRISA = %011111 'set PortA directions: all input except for pin 2 (piezo/led)
    WPUA = %110111 'enable weak pull-ups PortA
    IOCA = %000000 'disable PORTA.0 Int On Change

    TRISC = %000000 'set PortC directions: all outputs

    PORTA = %000000
    PORTC = %000000

    INPUT trigger
    OUTPUT mod_out
    OUTPUT tone


    '---------------------------------------------------------------------------


    blast_ID = %111111 'team=Green; damage=100

    '---------------------------------------------------------------------------

    start:

    '************************************************* ************
    '************************************************* ************
    '********************* MAIN PROGRAM **************************
    '************************************************* ************


    wait_trigger:

    temp = 0
    PAUSE 100
    IF trigger = 1 THEN wait_trigger

    FOR temp = 1 to 15 'hold 3 seconds to charge
    IF trigger = 1 THEN wait_trigger
    PAUSE 200
    NEXT temp

    charge_beep:
    'emit 4 short beeps when charged
    HIGH tone
    PAUSE 20
    LOW tone
    PAUSE 40
    HIGH tone
    PAUSE 20
    LOW tone
    PAUSE 40
    HIGH tone
    PAUSE 20
    LOW tone
    PAUSE 40

    wait_release:

    PAUSE 100
    IF trigger = 0 THEN wait_release

    countdown:

    pause 3000 '3000ms = 3 seconds delay before kaboom



    detonate:


    '************************************************* *****


    For temp2 = 1 to 4


    '************************************************* *****

    send_blast: 'send 24 bits
    CCP1CON = 12 'send MT header pulse (2.4mS)
    pauseus mtheader
    CCP1CON = 0

    blast_first_byte:
    databyte = %00101010 'packet_ID=0 (shot); playerID = 42 (GRNDE)

    send_byte: 'send 8 bits (databyte)
    For bit_counter = 1 TO 8 'send 8 data bits MSB first
    pauseus mtspace 'send space -- space between data pulses
    IF databyte.7 = 1 Then trans1
    CCP1CON = 12 'send zero
    pauseus mtbit0
    CCP1CON = 0
    @ rlf _databyte,F
    GoTo bypassx
    trans1:
    CCP1CON = 12 'send one
    pauseus mtbit1
    CCP1CON = 0
    @ rlf _databyte,F
    bypassx:
    Next bit_counter

    blast_second_byte:
    databyte = blast_ID 'team; damage

    send_byte_short: 'send 6 bits (databyte)
    For bit_counter = 1 TO 6 'send 6 data bits MSB first
    pauseus mtspace 'send space
    IF databyte.5 = 1 Then trans1_short 'read from bit 5
    CCP1CON = 12 'send zero
    pauseus mtbit0
    CCP1CON = 0
    @ rlf _databyte,F 'databyte << 1
    GoTo bypassx_short
    trans1_short:
    CCP1CON = 12 'send one
    pauseus mtbit1
    CCP1CON = 0
    @ rlf _databyte,F
    bypassx_short:
    Next bit_counter




    '************************************************* *****
    pause 500

    Next temp2


    '************************************************* *****


    pause 60000 'wait for 1 minute

    GOTO wait_trigger 'can be reused again now



    End

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Compiles fine over here. At least for a 16F684.
    http://www.scalerobotics.com

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Grenade compiles fine here too ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Quote Originally Posted by fourtech View Post
    C:\PBP\16F684.BAS ERROR Line 135: Bad expression.
    Rename your source file to something other than the part number.
    PBP need to include a file named 16F684.BAS from the PBP folder.
    But instead it includes your source code again. Creating many duplicates.
    Last edited by Darrel Taylor; - 20th February 2012 at 07:27.
    DT

  8. #8
    Join Date
    Jan 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: help about error messages

    Hello Mr. Darrel
    thanks a lot for you suggestion
    did You pbp 2.6 or 2.4 for compiling the code, I'm tring to use pbp 2.6 under melabs ide 8.76.

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