Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ISR is not a label ISR isn't even listed in pic basic pro compile book

Status
Not open for further replies.

rayel

Newbie level 5
Newbie level 5
Joined
Sep 17, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,364
Hi
I found this program in the pic basic pro book listed here on this site so I assumed the programs should run ok
but I run across this problem as soon as I typed in compile ISR is not a label . what am I doing wrong
im sure everything is typed in ok and I am using the pic6f628 . I took a screen shot of the errors and if
you look below the 1st error there are several more all the way down to line 52
here is the screen shot


ISR is not a label.JPG
I uploaded the image but don't see it I hope it goes through am new at this site and I am still learning
Thanks Rayel

Here is the program
Code:
'****************************************************************
'*  Name  : 7 seg test from pic basic pro chapter6.5.BAS *
'*  Author  : ray                                                                    *
'*  VIEW...EDITOR OPTIONS]                                              *
'*          :                                                                               *
'*  Date    : 9/26/2013                                                         *
'*  Version : 1.0                                                                    *
'*  Notes   : using pic16f628      2 digits 0 to 99                   *
'*          :                                                                                *
'******************************************************************
	
define osc 4
define oscal_2k 1
cmcon = 7		
			
    Digit var byte	                 'Value of number to be displayed
    Mask var byte	                 'Mask of number to be displayed
	W var byte	                     'temporary variable digit
	i var byte	                     'temporary variable	
	LEDDis1	var  PORTA.1	         'Transistor for ones digit	
	LEDDis2  var PORTA.0	         'Transistor for tens digit
	TRISA=%00000000	                 'all pins of port A are output	
	TRISB=%00000000	                 'all pins of port B are output	
	LEDDis1=0	                     'ones digit is off at the start	
	LEDDis2=0	                     'tens digit is off at the start	
	INTCON = %00100000	             'Enable interrupt TMRO	
	OPTION_REG  = %10000000          'Initialization of presraler	
			
	On Interrupt Goto ISR	          'Interrupt vector	
	INTCON = %10100000	              'Enable interrupts	
	W=0	                              'Initialization of variable W

	
Main:	                              'Beginning of the program		
	for i=1 to 99	                  'Print values from 0 to 99 displayed	
	W=W +l	                          'Increase variable W		
	Gosub Prepare	                  'Prepare value from W to be displayed	
	pause 500	                      'Pause to see the digits		
	next i		
	goto Main	                      'Print values from 0 to 99 again	

Prepare:	
    Digit=W dig 1	                  'Value of ones is put to var. Digit	
	Gosub bin2seg	                  'Converting digit to mask	
	Maskl=Digit	                      'Mask 1 contains the mask of ones	
	
    Digit=W dig 0	
	Gosub bin2seg	                  'Converting digit to mask	
	Mask2=Digit	                      'Mask 1 contains the mask of tens	
	Return	                          'Return from subroutine	
bin2seg:		
	Lookup Digit,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6f],Cifra
	Return

Disable	                          'Disable interrupts while ISR is executing
 
ISR:	
	PORTB=Mask1	                  'Put a mask of tens digit to port B	
	LEDDis2=1	                  'Print the ones digit	
	pause 1                       ' hold it printed for 1 ms
	LEDDis2=0	                  'turn off the tens digit
	
	PORTB=Mask2	                  'Put a mask of ones digit to port B	
	LEDDisl=1	                  'Print the ones digit	
	pause 1	                      'Hold it printed for 1 ms	
	LEDDisl=0	                  'turn off the ones digit
	
	INTCON.2 = 0	              'Clear TOIF flag	
                resume            'return to program
	Enable	                      'Interrupts  are enabled again
	End	                          'End of program
 
Last edited by a moderator:

It is giving some other errors. Where is Mask1 in code?


Code - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'************************************************* ***************
'* Name : 7 seg test from pic basic pro chapter6.5.BAS *
'* Author : ray *
'* VIEW...EDITOR OPTIONS] *
'* : *
'* Date : 9/26/2013 *
'* Version : 1.0 *
'* Notes : using pic16f628 2 digits 0 to 99 *
'* : *
'************************************************* *****************
 
define osc 4
define oscal_2k 1
 
DEFINE INTHAND myHI_ISR ' Assign High Priority Interrupt Service Routine label
DEFINE INTLHAND myLP_ISR  ' Assign Low Priority Interrupt Service Routine label  
    cmcon = 7   
 
    Digit var byte   'Value of number to be displayed
    Mask var byte    'Mask of number to be displayed
    W var byte   'temporary variable digit
    i var byte   'temporary variable
        
    LEDDis1 var PORTA.1  'Transistor for ones digit 
    LEDDis2 var PORTA.0  'Transistor for tens digit
    TRISA = %00000000    'all pins of port A are output 
    TRISB = %00000000    'all pins of port B are output 
    LEDDis1 = 0  'ones digit is off at the start    
    LEDDis2 = 0  'tens digit is off at the start    
    INTCON = %00100000   'Enable interrupt TMRO 
    OPTION_REG = %10000000 'Initialization of presraler 
 
    GOTO main
    
On Interrupt Goto myHI_ISR   'Interrupt vector  
    INTCON = %10100000   'Enable interrupts 
    W=0  'Initialization of variable W
Disable  'Disable interrupts while ISR is executing
 
myHI_ISR:
    PORTB = Mask1    'Put a mask of tens digit to port B    
    LEDDis2 = 1  'Print the ones digit
    pause 1 ' hold it printed for 1 ms
    LEDDis2=0    'turn off the tens digit
 
    PORTB = Mask2    'Put a mask of ones digit to port B    
    LEDDis1 = 1  'Print the ones digit  
    pause 1  'Hold it printed for 1 ms  
    LEDDis1 = 0  'turn off the ones digit
 
    INTCON.2 = 0     'Clear TOIF flag   
resume 'return to program
    
Enable   'Interrupts are enabled again
 
 
Main:    'Beginning of the program  
    for i = 1 to 99  'Print values from 0 to 99 displayed   
    W = W + l    'Increase variable W   
    Gosub Prepare    'Prepare value from W to be displayed  
    pause 500    'Pause to see the digits   
    next i  
    goto Main    'Print values from 0 to 99 again   
 
Prepare:    
    Digit = W dig 1  'Value of ones is put to var. Digit    
    Gosub bin2seg    'Converting digit to mask  
    Mask2 = Digit    'Mask 1 contains the mask of tens  
    Return   'Return from subroutine
        
bin2seg:    
    Lookup Digit,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6f],Cifra
    Return
    
End  'End of program

 
Last edited:

hi Jay
I just ran mine with the line numbers it came up line46
yours is on line68 but it says maks2 mine is mask 1
how did you get the expanded view ???
I also put a remark statement in front of ((goto ISR) your line 35 but yours
is worded different then it gave me an error on your line59 ((w=w +1))
it just seems to be giving me nothing but syntac error or bad statement
Thanks Ray
 


Code - [expand]
1
Mask var byte

Mask is declared as byte but not used. Mask1 and Mask2 is not declared but used in code. Post the link for original code source.

One error. Are you sure the code works? Digit is declared as byte and the name of lookup (array) is also Digit. maybe it is causing the problem.


Code - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
'************************************************* ***************
'* Name : 7 seg test from pic basic pro chapter6.5.BAS *
'* Author : ray *
'* VIEW...EDITOR OPTIONS] *
'* : *
'* Date : 9/26/2013 *
'* Version : 1.0 *
'* Notes : using pic16f628 2 digits 0 to 99 *
'* : *
'************************************************* *****************
 
define osc 4
define oscal_2k 1
 
DEFINE INTHAND myHI_ISR ' Assign High Priority Interrupt Service Routine label
DEFINE INTLHAND myLP_ISR  ' Assign Low Priority Interrupt Service Routine label  
    cmcon = 7   
 
    Digit var byte   'Value of number to be displayed
    Mask var byte    'Mask of number to be displayed
    Mask1 var byte   'Mask of number to be displayed
    Mask2 var byte   'Mask of number to be displayed
    W var byte   'temporary variable digit
    i var byte   'temporary variable
        
    LEDDis1 var PORTA.1  'Transistor for ones digit 
    LEDDis2 var PORTA.0  'Transistor for tens digit
    TRISA = %00000000    'all pins of port A are output 
    TRISB = %00000000    'all pins of port B are output 
    LEDDis1 = 0  'ones digit is off at the start    
    LEDDis2 = 0  'tens digit is off at the start    
    INTCON = %00100000   'Enable interrupt TMRO 
    OPTION_REG = %10000000 'Initialization of presraler 
 
    GOTO main
    
On Interrupt Goto myHI_ISR   'Interrupt vector  
    INTCON = %10100000   'Enable interrupts 
    W = 0    'Initialization of variable W
Disable  'Disable interrupts while ISR is executing
 
myHI_ISR:
    
    PORTB = Mask1    'Put a mask of tens digit to port B    
    LEDDis2 = 1  'Print the ones digit
    pause 1 ' hold it printed for 1 ms
    LEDDis2 = 0  'turn off the tens digit
 
    PORTB = Mask2    'Put a mask of ones digit to port B    
    LEDDis1 = 1  'Print the ones digit  
    pause 1  'Hold it printed for 1 ms  
    LEDDis1 = 0  'turn off the ones digit
 
    INTCON.2 = 0     'Clear TOIF flag   
resume 'return to program
    
Enable   'Interrupts are enabled again
 
 
Main:    'Beginning of the program  
    for i = 1 to 99  'Print values from 0 to 99 displayed   
        W = W + 1    'Increase variable W   
        Gosub Prepare    'Prepare value from W to be displayed  
        pause 500    'Pause to see the digits   
    next i
        
    goto Main    'Print values from 0 to 99 again   
 
Prepare:    
    Digit = W dig 1  'Value of ones is put to var. Digit    
    Gosub bin2seg    'Converting digit to mask  
    Mask2 = Digit    'Mask 1 contains the mask of tens  
    Return   'Return from subroutine
        
bin2seg:    
    Lookup Digit,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6f],Cifra
    Return
    
End  'End of program

 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top