Error 30 .scr file
Error 30 overwriting same counter location
When I debug my SX/B program I get the above error in the SCR file generated.
Does anyone have a clue to what needs fixed?
When I debug my SX/B program I get the above error in the SCR file generated.
Does anyone have a clue to what needs fixed?
Comments
You either have code before an interrupt keyword, or you have more code than will fit in the device.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My goal is to live forever...Or die trying.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
'Variables - ops, ms, hs, ts, sec01
' Unknown commands- COMPARE
DEVICE SX28,OSCHS3, TURBO, STACKX, OPTIONX, BOR26 ' HIGH SPEED OSCILLATOR BOR26 Brown out reset
IRC_CAL IRC_SLOW ' TURBO RUNS 4X FASTER THAN COMPATIBILITY MODE.
freq 40_000_000 ' IRC_CAL calibrates the internal oscillator. SETS THE INTERNAL OSCILLATOR TO IT'S SLOWEST VALUE
ID "TIMER" ' SETS THE STARTING POINT OF THE PROGRAM FOR THE ASSEMBLER
' 50 kHz
'
' IO Pins
'
' Seg_Map VAR RB 'display segments (anodes)
_PARAM1 VAR Byte(1)
display VAR Byte(4) 'array size 0 to size-1
'
TIMER
'Clock VAR BYTE(3)
ms VAR Byte(1)
hs VAR Byte(1)
ts VAR Byte(1)
sec01 Var Byte(1)
DigPntr Var Byte(1)
DigCtrl Var RC
'
VARIABLES
ops VAR Byte(1)
Go VAR Byte(1)
RA0_CLEAR VAR Byte(1)
RA1_START VAR Byte(1)
steps VAR Byte(1)
M_STOP VAR Byte(1)
M_Run VAR BYTE(1)
'
' CONSTANTS
'
Yes CON 0
No CON 1
' THE COMPARE STATEMENT SETS RB.1 AND RB.2 AS INPUTS AND SETS RB.0 AND _PARAM1 TO 0 IF RB.1 > RB.2.
' So if the opt isolater is blocked RB.1 > RB.2. The LED lights and the timer stops due to _PARAM1 going high and
' setting to G0 = M_Stop
TRIS_B = %00000111 'CATHODE PINS SET TO OUTPUT Register B; Rb.0 Rb.1 Rb.2 are inputs Rb.3 thru Rb.7 are outputs THIS COULD BE WRONG
PLP_A = %00000011 ' pull up the unused pins on RA. Ra.0 & Ra.1 the weak pull up resistor is disable.
COMPARE 1, _PARAM1 ' STARTS THE COMPARATOR IN MODE 1; MONITORS rb.1 AND RB.2 OUTPUTS TO RB.0 to see if the optp isolator is blocked
' adjust Potentiometer to fine tune comparison.
PROGRAM START
Segments PIN RC OUTPUT '
'Seg_Map = %00000000
INTERRUPT 1000 'Rate 1000 ' CHECK ISR EVERY MILLISECOND
' ms=%00000000
' GOTO INT_HANDLER
INT_HANDLER:
IF ops <> M_RUN THEN GOTO Next_Digit 'OPS HOLDS THE CURRENT THREE STATUS OF TIMER -
' STOPPED AND CLEAR, RUNNING AND STOPPED
Update_Clock:
INC ms
IF ms = 10 THEN ' CHECKS TO SEE IF WE NEED TO WRAP BACK TO ZERO
ms = 0
INC hs
IF hs = 10 THEN
hs = 0
INC ts
IF ts = 10 THEN
ts = 0
INC sec01
IF sec01 = 10 THEN
sec01 = 0
INC sec01
IF sec01 = 6 THEN
ops = M_STOP ' stops timer
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Next_Digit: ' Defines which LED is being cycled
INC DigPntr
IF DigPntr = 4 Then '4 was numdigits believe this routine looks for display (4), the number of LED, then resets DigPntr
DigPntr = 0
ENDIF
Update_Seqs:
Segments = %00000000 ' clears the LED for next digit creates a crisper display.
READ DP_Map + DigPntr, DigCtrl ' DP_Map is a table with one value READ COMMAND gets data from table offsets it digPntr and puts it in DigCtrl
Segments = display(DigCtrl)
Check_Finish:
IF _PARAM1 = No THEN ' CHECKS TO SEE IF OPTO-TRANSISTOR IS BLOCKED
ops = M_STOP ' MUST PUSH THE CLEAR BUTTON TO RESET
ENDIF
RETURNINT ' reset the RTCC value and re-enables interrupts
' UPDATE_DISPLAY: ' DECIMAL POINT DISPLAY
' IF DPDigit = 0 THEN
' READ DP_Map + ms, display(0)
' ELSE
' READ Seg_Map + ms, display(0)
' END IF
Start:
IF _PARAM1 > 0 THEN ' If Rb.0 is 1 then go else don't start
GO = _PARAM1 ' Go will equal one to stop timer
ELSE
GO = 0
ENDIF
' Clear and Start go directly to Ra.0 and Ra.1. Ra.1 going high starts the timer, but the timer must be in mode zero defined as RAO_CLEAR.
' The timer starts by updating ops to M-Run. The timer stops when the opto-transistor goes high causing the comparator to go high the timer
' will be stop by changing the ops mode to M_STOP
MAIN:
DO while steps < 61
GOTO UPDATE_DISPLAY
IF Go = Yes THEN
IF ops = RA1_START THEN 'ops sets the three mode of operation 0) stopped and cleared 1)running
ops = M_RUN ' 2) stopped
ENDIF
ENDIF
IF GO = No THEN
IF ops = M_STOP THEN
PUT @ms, 0, 0, 0, 0, 0
ops = RA0_CLEAR
ENDIF
ENDIF
LOOP
UPDATE_DISPLAY: ' called only once
'
READ Seg_Map + ms, display(0) ' display (0) is the LED for milliseconds
READ Seg_Map + hs, display(1) ' Transfers seg_Map data table into display array.
READ Seg_Map + ts, display(2) '
READ DP_Map + sec01, display(3)
IF sec01 = 0 THEN
display(4) = %11111111 ' Blanks ms display
ELSE
READ Seg_Map + sec01, display(4)
ENDIF
steps = steps + 1
RETURN
Seg_Map: ' segments maps
' .gfedcba
DATA %00111111 ' 0
DATA %00000110 ' 1
DATA %01011011 ' 2
DATA %01001111 ' 3
DATA %01100110 ' 4
DATA %01101101 ' 5
DATA %01111101 ' 6
DATA %00000111 ' 7
DATA %01111111 ' 8
DATA %01100111 ' 9
DATA %01110111 ' A
DATA %01111100 ' B
DATA %00111001 ' C
DATA %01011110 ' D
DATA %01111001 ' E
DATA %01110001 ' F
DP_Map:
DATA %11110111
All of this:
TRIS_B = %00000111 'CATHODE PINS SET TO OUTPUT Register B; Rb.0 Rb.1 Rb.2 are inputs Rb.3 thru Rb.7 are outputs THIS COULD BE WRONG PLP_A = %00000011 ' pull up the unused pins on RA. Ra.0 & Ra.1 the weak pull up resistor is disable. COMPARE 1, _PARAM1 ' STARTS THE COMPARATOR IN MODE 1; MONITORS rb.1 AND RB.2 OUTPUTS TO RB.0 to see if the optp isolator is blocked ' adjust Potentiometer to fine tune comparison. PROGRAM START
has to be after the RETURNINT
In fact the TRIS_B, PLP_A, and COMPARE won't even run because they are before the "Start:" label. The line "PROGRAM START" tells the SX chip where to start executing code from. Anything before the "Start:" label will never be executed.
I have moved the code around, so this should at least compile:
'Variables - ops, ms, hs, ts, sec01 ' Unknown commands- COMPARE DEVICE SX28,OSCHS3, TURBO, STACKX, OPTIONX, BOR26 ' HIGH SPEED OSCILLATOR BOR26 Brown out reset IRC_CAL IRC_SLOW ' TURBO RUNS 4X FASTER THAN COMPATIBILITY MODE. freq 40_000_000 ' IRC_CAL calibrates the internal oscillator. SETS THE INTERNAL OSCILLATOR TO IT'S SLOWEST VALUE ID "TIMER" ' SETS THE STARTING POINT OF THE PROGRAM FOR THE ASSEMBLER ' 50 kHz ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- ' Seg_Map VAR RB 'display segments (anodes) _PARAM1 VAR Byte(1) display VAR Byte(4) 'array size 0 to size-1 '---------TIMER-------------------- 'Clock VAR BYTE(3) ms VAR Byte(1) hs VAR Byte(1) ts VAR Byte(1) sec01 Var Byte(1) DigPntr Var Byte(1) DigCtrl Var RC '--------VARIABLES----------------- ops VAR Byte(1) Go VAR Byte(1) RA0_CLEAR VAR Byte(1) RA1_START VAR Byte(1) steps VAR Byte(1) M_STOP VAR Byte(1) M_Run VAR BYTE(1) '--------------------------------------------- ' CONSTANTS '----------------------------------------- Yes CON 0 No CON 1 ' THE COMPARE STATEMENT SETS RB.1 AND RB.2 AS INPUTS AND SETS RB.0 AND _PARAM1 TO 0 IF RB.1 > RB.2. ' So if the opt isolater is blocked RB.1 > RB.2. The LED lights and the timer stops due to _PARAM1 going high and ' setting to G0 = M_Stop Segments PIN RC OUTPUT ' 'Seg_Map = %00000000 INTERRUPT 1000 'Rate 1000 ' CHECK ISR EVERY MILLISECOND ' ms=%00000000 ' GOTO INT_HANDLER INT_HANDLER: IF ops <> M_RUN THEN GOTO Next_Digit 'OPS HOLDS THE CURRENT THREE STATUS OF TIMER - ' STOPPED AND CLEAR, RUNNING AND STOPPED Update_Clock: INC ms IF ms = 10 THEN ' CHECKS TO SEE IF WE NEED TO WRAP BACK TO ZERO ms = 0 INC hs IF hs = 10 THEN hs = 0 INC ts IF ts = 10 THEN ts = 0 INC sec01 IF sec01 = 10 THEN sec01 = 0 INC sec01 IF sec01 = 6 THEN ops = M_STOP ' stops timer ENDIF ENDIF ENDIF ENDIF ENDIF Next_Digit: ' Defines which LED is being cycled INC DigPntr IF DigPntr = 4 Then '4 was numdigits believe this routine looks for display (4), the number of LED, then resets DigPntr DigPntr = 0 ENDIF Update_Seqs: Segments = %00000000 ' clears the LED for next digit creates a crisper display. READ DP_Map + DigPntr, DigCtrl ' DP_Map is a table with one value READ COMMAND gets data from table offsets it digPntr and puts it in DigCtrl Segments = display(DigCtrl) Check_Finish: IF _PARAM1 = No THEN ' CHECKS TO SEE IF OPTO-TRANSISTOR IS BLOCKED ops = M_STOP ' MUST PUSH THE CLEAR BUTTON TO RESET ENDIF RETURNINT ' reset the RTCC value and re-enables interrupts PROGRAM START ' UPDATE_DISPLAY: ' DECIMAL POINT DISPLAY ' IF DPDigit = 0 THEN ' READ DP_Map + ms, display(0) ' ELSE ' READ Seg_Map + ms, display(0) ' END IF Start: TRIS_B = %00000111 'CATHODE PINS SET TO OUTPUT Register B; Rb.0 Rb.1 Rb.2 are inputs Rb.3 thru Rb.7 are outputs THIS COULD BE WRONG PLP_A = %00000011 ' pull up the unused pins on RA. Ra.0 & Ra.1 the weak pull up resistor is disable. COMPARE 1, _PARAM1 ' STARTS THE COMPARATOR IN MODE 1; MONITORS rb.1 AND RB.2 OUTPUTS TO RB.0 to see if the optp isolator is blocked ' adjust Potentiometer to fine tune comparison. IF _PARAM1 > 0 THEN ' If Rb.0 is 1 then go else don't start GO = _PARAM1 ' Go will equal one to stop timer ELSE GO = 0 ENDIF ' Clear and Start go directly to Ra.0 and Ra.1. Ra.1 going high starts the timer, but the timer must be in mode zero defined as RAO_CLEAR. ' The timer starts by updating ops to M-Run. The timer stops when the opto-transistor goes high causing the comparator to go high the timer ' will be stop by changing the ops mode to M_STOP MAIN: DO while steps < 61 GOTO UPDATE_DISPLAY IF Go = Yes THEN IF ops = RA1_START THEN 'ops sets the three mode of operation 0) stopped and cleared 1)running ops = M_RUN ' 2) stopped ENDIF ENDIF IF GO = No THEN IF ops = M_STOP THEN PUT @ms, 0, 0, 0, 0, 0 ops = RA0_CLEAR ENDIF ENDIF LOOP UPDATE_DISPLAY: ' called only once ' READ Seg_Map + ms, display(0) ' display (0) is the LED for milliseconds READ Seg_Map + hs, display(1) ' Transfers seg_Map data table into display array. READ Seg_Map + ts, display(2) ' READ DP_Map + sec01, display(3) IF sec01 = 0 THEN display(4) = %11111111 ' Blanks ms display ELSE READ Seg_Map + sec01, display(4) ENDIF steps = steps + 1 RETURN Seg_Map: ' segments maps ' .gfedcba DATA %00111111 ' 0 DATA %00000110 ' 1 DATA %01011011 ' 2 DATA %01001111 ' 3 DATA %01100110 ' 4 DATA %01101101 ' 5 DATA %01111101 ' 6 DATA %00000111 ' 7 DATA %01111111 ' 8 DATA %01100111 ' 9 DATA %01110111 ' A DATA %01111100 ' B DATA %00111001 ' C DATA %01011110 ' D DATA %01111001 ' E DATA %01110001 ' F DP_Map: DATA %11110111
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My goal is to live forever...Or die trying.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
Post Edited (Bean (Hitt Consulting)) : 10/23/2007 1:32:47 PM GMT