I am trying to build the HEX file for a new program in 0.98.05 2019-04-20 (Windows 32 bit) and I get thew following error message: Error: GCASM: Symbol 6.0 has not been defined . I can't find a "6.0" anywhere in my program. Where do I start looking for the problem?
(It's been 50 years since I did any programming in college.....)
Thanks!
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the program. I'll be away for a week, so no rush....
It is a program I am porting over from an old version of basic - and I am sure there are places I could re-write it much more efficiently!
;Chip Settings
#chip 16f876, 4 ;4 mhz internal clock
#config WDTE=OFF, BOREN=OFF, CP=OFF, WRT=OFF
DIR PORTB b'11111111'
DIR PORTC.1 OUT
DIR PORTC.2 OUT
DIR PORTC.4 IN
DIR PORTC.6 IN
DIR PORTA.0 OUT
DIR PORTA.1 IN
DIR PORTA.2 OUT
DIR PORTA.3 OUT
IF PORTC.4=1 AND PORTB.1=1 then
GOTO ITEM10
end if
GOTO ITEM11A
ITEM10:
GEAR_ACTIVE = 1
HORN_ACTIVE = 1
HORN_RESISTOR = 0
GEAR_RESISTOR = 0
GOTO BASE1
ITEM11A:
IF PORTC.4=1 AND PORTB.1=0 then
GOTO ITEM11
end if
GOTO ITEM12A
ITEM11:
GEAR_ACTIVE = 1
HORN_ACTIVE = 0
GEAR_RESISTOR = 0
HORN_RESISTOR = 1
GOTO BASE1
ITEM12A:
IF PORTC.4=0 AND PORTB.1=1 then
GOTO ITEM12
end if
GOTO ITEM13A
ITEM12:
GEAR_ACTIVE = 0
HORN_ACTIVE = 1
GEAR_RESISTOR = 1 ;DIFFERENT THAN ORIGINAL PROGRAM!
HORN_RESISTOR = 0
GOTO BASE1
ITEM13A:
IF PORTC.4=0 AND PORTB.1=0 then
GOTO ITEM13
end if
GOTO ITEM99
ITEM13:
GEAR_ACTIVE = 0
HORN_ACTIVE = 0
GEAR_RESISTOR = 1
HORN_RESISTOR = 1
GOTO BASE1
BASE1:
IF PORT B.0=1 then
GOTO BASE2 ;SETS STALL MODE
end if
STALL = 1 ;STALL IF B0 = 1
GOTO BASE3
BASE2:
STALL = 0 ;STALL IF B0 = 0
BASE3:
IF PORTB.2=0 then
GOTO FLIGHTTEST ;CHECK FOR FLIGHT TEST
end if
GOTO BASE
FLIGHTTEST:
PORTA.0=1 ;TURN LIGHT ON
FLIGHT_TEST = 1 ;SETS FLIGHT TEST MODE
WAIT 200 MS
IF PORTB.2=0 then
GOTO FLIGHTTEST
end if
BASE:
;GROUND PROGRAM
IF PORTB.4=GEAR_ACTIVE then
GOTO TAKEOFF ;GEAR UP LIGHT GOES OFF
end if
IF PORTB.2=0 then
GOSUB TEST ;TEST SWITCH PUSHED
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;STALL VOICE
end if
GOTO BASE
TAKEOFF:
;TAKEOFF DELAY
WAIT 2000 MS
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
FOR TIM1=1 TO 70
WAIT 200 MS
IF PORTB.4<>GEAR_ACTIVE AND PORTB.5=HORN_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALL VOICE IF SIGNAL
end if
WAIT 200 MS
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOTO HORNVOICE ;ACTIVATE HORN VOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALL VOICE IF SIGNAL
end if
WAIT 100 MS
NEXT
FLYING:
;IN FLIGHT SEQUENCE
IF FLIGHT_TEST=1 then
GOTO FLYING1
end if
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;GEAR DOWN RETURN TO GROUND PROGRAM
end if
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
IF PORTB.2=0 then
GOSUB TEST
end if
IF PORTB.3=0 then
GOTO SIGX
end if
GOTO FLYING
SIGX:
IF PORTB.6=0 then
GOSUB MUTE
end if
IF PORTB.3=0 then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 200 MS
IF PORTB.3=0 then
GOSUB GEARVOICE
end if
IF PORTB.2=0 then
GOSUB BLINK ;STOP VOICE
end if
GOTO FLYING
STALLVOICE:
PORTA.3=1 ;TURN OFF ANY VOICE
WAIT 20 MS
PORTC.1=0 ;SELECT STALL VOICE
PORTC.2=0
WAIT 20 MS
PORTA.3=0 ;ACTIVATE STALL VOICE
WAIT 2600 MS ;STALL VOICE SOUNDING
PORTA.3=1 ;TURN OFF STALL VOICE
WAIT 10 MS
IF PORTB.0=STALL then
GOTO STALLVOICE ;LOOP IF SIGNAL STILL THERE
end if
Return
TEST:
;TEST VOICE SEQUENCE
IF PORTB.3=0 AND PORTB.2=0 then
GOTO TEST1 ;SOUND VOICE
end if
WAIT 200 MS
IF PORTB.3=0 AND PORTB.2=0 then
GOTO TEST1 ;CHECK AGAIN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
Return ;NO SIGNALS PRESENT
TEST1:
PORTC.1=1 ;SELECT TEST VOICE
WAIT 20 MS
PORTA.3=0 ;ACTIVATE VOICE
WAIT 1500 MS
PORTA.3=1 ;STOP VOICE
PORTC.1=0 ;RESET VOICE SELECT
WAIT 500 MS
IF PORTB.2=1 then
GOTO TEST2 ;CHECK FOR SW RELEASED AND RETURN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
IF PORTB.2=0 then
GOSUB BLINK ;SW HELD GOTO BLINK
end if
TEST2:
RETURN
BLINK:
PORTA.0=1 ;TURN ON LIGHT
WAIT 500 MS
IF PORTB.2=0 then
GOTO BLINK ;LOOP IF SW HELD
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
BLINK1:
PORTA.0=1
WAIT 500 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.2=0 then
GOTO BLINK2 ;SWITCH PUSHED TO RESET
end if
IF PORTB.0=0 then
GOSUB STALLVOICE
end if
PORTA.0=0
WAIT 500 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.2+0 then
GOTO BLINK2 ;SWITCH PUSHED TO RESET
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
GOTO BLINK1
BLINK2:
WAIT 100 MS
IF PORTB.2=0 then
GOTO BLINK2
end if
IF PORTB.0-STALL then
GOSUB STALLVOICE
end if
PORTA.0=0
RETURN
HORNVOICE:
WAIT 400 MS
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR_ACTIVE then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
RETURN
GEARVOICE:
PORTC.2=1
WAIT 20 MS
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
PORTA.3=0
WAIT 4000 MS
PORTA.3=1
PORTC.2=0
IF PORTB.2=0 then
GOSUB BLINK ;SWITCH PUSHED TO STOP VOICE
end if
RETURN
MUTE:
;MUTE SEQUENCE
WAIT 100 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 500 MS
IF PORTB.6=0 then
GOTO MUTE ;LOOP UNTIL MUTE ENDS
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 200 MS
RETURN
FLYING1:
PORTA.0=1
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE4 ;GEAR DOWN, GOTO SPECIAL PROGRAM
end if
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALLVOICE
end if
IF PORTB.2=0 then
GOSUB TEST ;CHECK FOR TEST SWITCH PUSHED
end if
IF PORTB.3=0 then
GOSUB SIGA ;CHECK FOR GROUND SIGNAL
end if
GOTO FLYING1 ;RETURN TO FLYING
SIGA:
IF PORTB.6=0 then
GOSUB MUTE ;IF MUTE, DO NOTHING
end if
IF PORTB.3=0 then
GOSUB GEARVOICE ;PLAY GEAR VOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
RETURN ;RETURN TO FLYING
BASE4:
;SPECIAL SEQUENCE
IF PORTB.3=0 then
GOSUB GVOICE1
end if
WAIT 500 MS
GOTO BASE4 ;LOOP UNTIL GROUND SIGNAL
GVOICE1:
GOSUB GEARVOICE
WAIT 500 MS
GOSUB GEARVOICE
GOTO BASE ;RETURN TO GROUND PROGRAM
RETURN
ITEM99:
;SHOULD NEVER GET HERE!
GOTO ITEM10
EDIT: Added ~~~ Format tags to make Code more readable.
Last edit: Chris Roper 2019-05-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I added #option explicit. This hilighted typos in the variable names.
I then indented your code to show you the code typos.
However, the error messages did not help you. We need resolve this im a future release.
Anobium
#chip 16f876, 4 ;4 mhz internal clock
#config WDTE=OFF, BOREN=OFF, CP=OFF, WRT=OFF
#option explicit
dim GEAR_ACTIVE, HORN_ACTIVE, HORN_RESISTOR, GEAR_RESISTOR, FLIGHT_TEST, as bit
dim Stall as bit
dim tim1 as byte
DIR PORTB b'11111111'
DIR PORTC.1 OUT
DIR PORTC.2 OUT
DIR PORTC.4 IN
DIR PORTC.6 IN
DIR PORTA.0 OUT
DIR PORTA.1 IN
DIR PORTA.2 OUT
DIR PORTA.3 OUT
IF PORTC.4=1 AND PORTB.1=1 then
GOTO ITEM10
end if
GOTO ITEM11A
ITEM10:
GEAR_ACTIVE = 1
HORN_ACTIVE = 1
HORN_RESISTOR = 0
GEAR_RESISTOR = 0
GOTO BASE1
ITEM11A:
IF PORTC.4=1 AND PORTB.1=0 then
GOTO ITEM11
end if
GOTO ITEM12A
ITEM11:
GEAR_ACTIVE = 1
HORN_ACTIVE = 0
GEAR_RESISTOR = 0
HORN_RESISTOR = 1
GOTO BASE1
ITEM12A:
IF PORTC.4=0 AND PORTB.1=1 then
GOTO ITEM12
end if
GOTO ITEM13A
ITEM12:
GEAR_ACTIVE = 0
HORN_ACTIVE = 1
GEAR_RESISTOR = 1 ;DIFFERENT THAN ORIGINAL PROGRAM!
HORN_RESISTOR = 0
GOTO BASE1
ITEM13A:
IF PORTC.4=0 AND PORTB.1=0 then
GOTO ITEM13
end if
GOTO ITEM99
ITEM13:
GEAR_ACTIVE = 0
HORN_ACTIVE = 0
GEAR_RESISTOR = 1
HORN_RESISTOR = 1
GOTO BASE1
BASE1:
' IF PORT B.0=1 then
IF PORTB.0=1 then 'there was a typo here... again NOT PICKED UP BY THE COMPILER! I discovered this when testing this code against an 18F chip
GOTO BASE2 ;SETS STALL MODE
end if
STALL = 1 ;STALL IF B0 = 1
GOTO BASE3
BASE2:
STALL = 0 ;STALL IF B0 = 0
BASE3:
IF PORTB.2=0 then
GOTO FLIGHTTEST ;CHECK FOR FLIGHT TEST
end if
GOTO BASE
FLIGHTTEST:
PORTA.0=1 ;TURN LIGHT ON
FLIGHT_TEST = 1 ;SETS FLIGHT TEST MODE
WAIT 200 MS
IF PORTB.2=0 then
GOTO FLIGHTTEST
end if
BASE:
;GROUND PROGRAM
IF PORTB.4=GEAR_ACTIVE then
GOTO TAKEOFF ;GEAR UP LIGHT GOES OFF
end if
IF PORTB.2=0 then
GOSUB TEST ;TEST SWITCH PUSHED
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;STALL VOICE
end if
GOTO BASE
TAKEOFF:
;TAKEOFF DELAY
WAIT 2000 MS
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
FOR TIM1=1 TO 70
WAIT 200 MS
IF PORTB.4<>GEAR_ACTIVE AND PORTB.5=HORN_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALL VOICE IF SIGNAL
end if
WAIT 200 MS
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;RETURN TO GROUND PROGRAM IF GEAR DOWN
end if
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOTO HORNVOICE ;ACTIVATE HORN VOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALL VOICE IF SIGNAL
end if
WAIT 100 MS
NEXT
FLYING:
;IN FLIGHT SEQUENCE
IF FLIGHT_TEST=1 then
GOTO FLYING1
end if
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE ;GEAR DOWN RETURN TO GROUND PROGRAM
end if
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
IF PORTB.2=0 then
GOSUB TEST
end if
IF PORTB.3=0 then
GOTO SIGX
end if
GOTO FLYING
SIGX:
IF PORTB.6=0 then
GOSUB MUTE
end if
IF PORTB.3=0 then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 200 MS
IF PORTB.3=0 then
GOSUB GEARVOICE
end if
IF PORTB.2=0 then
GOSUB BLINK ;STOP VOICE
end if
GOTO FLYING
STALLVOICE:
PORTA.3=1 ;TURN OFF ANY VOICE
WAIT 20 MS
PORTC.1=0 ;SELECT STALL VOICE
PORTC.2=0
WAIT 20 MS
PORTA.3=0 ;ACTIVATE STALL VOICE
WAIT 2600 MS ;STALL VOICE SOUNDING
PORTA.3=1 ;TURN OFF STALL VOICE
WAIT 10 MS
IF PORTB.0=STALL then
GOTO STALLVOICE ;LOOP IF SIGNAL STILL THERE
end if
Return
TEST:
;TEST VOICE SEQUENCE
IF PORTB.3=0 AND PORTB.2=0 then
GOTO TEST1 ;SOUND VOICE
end if
WAIT 200 MS
IF PORTB.3=0 AND PORTB.2=0 then
GOTO TEST1 ;CHECK AGAIN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
Return ;NO SIGNALS PRESENT
TEST1:
PORTC.1=1 ;SELECT TEST VOICE
WAIT 20 MS
PORTA.3=0 ;ACTIVATE VOICE
WAIT 1500 MS
PORTA.3=1 ;STOP VOICE
PORTC.1=0 ;RESET VOICE SELECT
WAIT 500 MS
IF PORTB.2=1 then
GOTO TEST2 ;CHECK FOR SW RELEASED AND RETURN
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
IF PORTB.2=0 then
GOSUB BLINK ;SW HELD GOTO BLINK
end if
TEST2:
RETURN
BLINK:
PORTA.0=1 ;TURN ON LIGHT
WAIT 500 MS
IF PORTB.2=0 then
GOTO BLINK ;LOOP IF SW HELD
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;CHECK FOR STALL
end if
BLINK1:
PORTA.0=1
WAIT 500 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.2=0 then
GOTO BLINK2 ;SWITCH PUSHED TO RESET
end if
IF PORTB.0=0 then
GOSUB STALLVOICE
end if
PORTA.0=0
WAIT 500 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB HORNVOICE
end if
'IF PORTB.2+0 then
IF PORTB.2=0 then
GOTO BLINK2 ;SWITCH PUSHED TO RESET
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
GOTO BLINK1
BLINK2:
WAIT 100 MS
IF PORTB.2=0 then
GOTO BLINK2
end if
'IF PORTB.0-STALL then
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
PORTA.0=0
RETURN
HORNVOICE:
WAIT 400 MS
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR_ACTIVE then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
RETURN
GEARVOICE:
PORTC.2=1
WAIT 20 MS
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
PORTA.3=0
WAIT 4000 MS
PORTA.3=1
PORTC.2=0
IF PORTB.2=0 then
GOSUB BLINK ;SWITCH PUSHED TO STOP VOICE
end if
RETURN
MUTE:
;MUTE SEQUENCE
WAIT 100 MS
IF PORTB.5=GEAR_ACTIVE AND PORTB.4=HORN_ACTIVE then
GOSUB GEARVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 500 MS
IF PORTB.6=0 then
GOTO MUTE ;LOOP UNTIL MUTE ENDS
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
WAIT 200 MS
RETURN
FLYING1:
PORTA.0=1
IF PORTB.4<>GEAR_ACTIVE then
GOTO BASE4 ;GEAR DOWN, GOTO SPECIAL PROGRAM
end if
IF PORTB.5=HORN_ACTIVE AND PORTB.4=GEAR_ACTIVE then
GOSUB HORNVOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE ;GOTO STALLVOICE
end if
IF PORTB.2=0 then
GOSUB TEST ;CHECK FOR TEST SWITCH PUSHED
end if
IF PORTB.3=0 then
GOSUB SIGA ;CHECK FOR GROUND SIGNAL
end if
GOTO FLYING1 ;RETURN TO FLYING
SIGA:
IF PORTB.6=0 then
GOSUB MUTE ;IF MUTE, DO NOTHING
end if
IF PORTB.3=0 then
GOSUB GEARVOICE ;PLAY GEAR VOICE
end if
IF PORTB.0=STALL then
GOSUB STALLVOICE
end if
RETURN ;RETURN TO FLYING
BASE4:
;SPECIAL SEQUENCE
IF PORTB.3=0 then
GOSUB GVOICE1
end if
WAIT 500 MS
GOTO BASE4 ;LOOP UNTIL GROUND SIGNAL
GVOICE1:
GOSUB GEARVOICE
WAIT 500 MS
GOSUB GEARVOICE
GOTO BASE ;RETURN TO GROUND PROGRAM
RETURN
ITEM99:
;SHOULD NEVER GET HERE!
GOTO ITEM10
Last edit: Anobium 2019-05-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to build the HEX file for a new program in 0.98.05 2019-04-20 (Windows 32 bit) and I get thew following error message: Error: GCASM: Symbol 6.0 has not been defined . I can't find a "6.0" anywhere in my program. Where do I start looking for the problem?
(It's been 50 years since I did any programming in college.....)
Thanks!
Bill
Hello Bill.
Thank you for the very clear statement of version info and your issue.
Post your program and we can help.
Last edit: Anobium 2019-05-10
Here is the program. I'll be away for a week, so no rush....
It is a program I am porting over from an old version of basic - and I am sure there are places I could re-write it much more efficiently!
EDIT: Added ~~~ Format tags to make Code more readable.
Last edit: Chris Roper 2019-05-13
Fixed. Typos.
I added #option explicit. This hilighted typos in the variable names.
I then indented your code to show you the code typos.
However, the error messages did not help you. We need resolve this im a future release.
Anobium
Last edit: Anobium 2019-05-14
@Bill. I have updated the compiler to better handle the condition you found. Ping me and I will provide you the updates.
We need to update the compiler further to improve this type of error - where your typo should have been handled correctly.