Public Variable not visible in Module Routine
Posted: Mon Apr 04, 2011 11:43 pm
I have an 18F87J50 program with three modules which compiles OK. I need a public variable called Hightime.
When I add the line "Public Dim Hightime As Word" in main, the program still compiles OK. As below.
When I try to use Hightime in module "TIMER3 ISR.bas" I get "Identifier not declared: Hightime". Is there a secret place where these public variables should be declared to be global?
Thanks anyone!!
This where I'm trying to use Hightime:
When I add the line "Public Dim Hightime As Word" in main, the program still compiles OK. As below.
When I try to use Hightime in module "TIMER3 ISR.bas" I get "Identifier not declared: Hightime". Is there a secret place where these public variables should be declared to be global?
Thanks anyone!!
Code: Select all
Device = 18F87J50 ' Setup the device/clock information
Clock = 48
Config FOSC = EC
#option USART_BRGH = true ' Use 16bit BRG so setbaudrate works
#option USART_BRG16 = true
Include "USART-2.bas"
Include "convert.bas"
Include "TIMER3 ISR.bas"
Dim LED As PORTE.1
Dim ADC0 As Word
Dim Freq As LongWord
Public Dim Hightime As Word
Code: Select all
Module TIMER3_Interrupt_Service_Routine
Const CCPR3_register_address=4018
Public Dim CCPR3_register_word As Word Absolute CCPR3_register_address
Dim CCPR3_interrupt_flag As PIR3.0
Dim Numberoftimes As Byte
Interrupt TIMER3_Interrupt()
For Numberoftimes = 1 To Hightime
High(PORTC.1)
Next
Low(PORTC.1)
CCPR3_interrupt_flag = 0 'clear CCP3 interrupt flag
End Interrupt