View Full Version : help about error messages
fourtech
- 19th February 2012, 08:29
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.
Acetronics2
- 19th February 2012, 09:45
Hi, Fourtech
Could you provide the full program you've written ???
This is the minimum requirement for the crystal ball to light up ... :barbershop_quartet_
seriously, looks to be a small typo somewhere ...
ALAIN
Charlie
- 19th February 2012, 11:35
Yes, likely a typo in line 135 but could be elsewhere
fourtech
- 19th February 2012, 16:48
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
ScaleRobotics
- 19th February 2012, 17:10
Compiles fine over here. At least for a 16F684.
Acetronics2
- 19th February 2012, 18:33
Grenade compiles fine here too ... :angel:
Alain
Darrel Taylor
- 20th February 2012, 07:24
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.
fourtech
- 20th February 2012, 10:25
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.
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.