I'll double check that, but if that were the case, wouldn't my baud rates and stuff be off as well on my serial port stuff?
I'll double check that, but if that were the case, wouldn't my baud rates and stuff be off as well on my serial port stuff?
Yes it would.
Didn't realize you had serial working along with the problem.
Thought maybe it was just an LCD, which wouldn't be affected.
Do you have other interrupts in the program too?
Something that might be keeping the interrupts locked up for too long?
<br>
DT
Yes, I have one other that's for Rx but it grabs a short 8 byte serial string once every 2 seconds.
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Receive, PBP, yes
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE RX_INT ; enable external (INT) interrupts
@ INT_ENABLE TMR1_INT ; enable external (INT) interrupts
15 seconds is a long time and is pretty consistient.
I did check, and I do have the following fuses set in my programmer.
Osc = HS, FSCM = on, Brown Out = Enabled,
Low Power Timer1 Osc = Low Power ??? Was default
Try it like this, and see if the Low Priority RX_INT helps.Code:DEFINE USE_LOWPRIORITY 1 INCLUDE "DT_INTS-18.bas" ; Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts INCLUDE "ReEnterPBP-18LP.bas" ; Include if using Low Pr. PBP INTS INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines ;----[High Priority Interrupts]----------------------------------------------- ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, _ClockCount, PBP, yes endm INT_CREATE ; Creates the High Priority interrupt processor ;----[Low Priority Interrupts]------------------------------------------------ INT_LIST_L macro ; IntSource, Label, Type, ResetFlag? INT_Handler RX_INT, _Receive, PBP, no endm INT_CREATE_L ; Creates the Low Priority interrupt processor ENDASM @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts @ INT_ENABLE RX_INT ; Enable USART Receive interrupts
DT
That works better.
Is this causing my problem since they are PBP Interrupts, it's not exiting like it should...
AdcMaxReads is at 64, Each time I loop I increment the channel, that way I only do 64 reads per loop.
GetADC:
ADCVAL = 0
ADCAVG = 0
For AdcCnt = 1 to AdcMaxReads
ADCIN NextChan,ADCVAL
ADCAVG = ADCAVG + ADCVal
Next AdcCnt
Reg[NextChan] = ADCAVG / AdcMaxReads
NextChan = NextChan + 1
If NextChan = 10 then 'Cycled thru all 9 analogs
If (LowBatSP > 0) Then
BatVolts = Reg[8]
GoSub CheckBat
EndIf
NextChan = 0
EndIf
Return
Main:
Gosub GetADC
Goto Main
Those A/D statements are in the Main Loop, they will not have any affect on the interrupts.
However, you haven't initialized the NextChan variable before starting. It may take several thousand readings from invalid channels before falling back into line when it rolls over.
But much like the RX handler, you may not have included that part of the program.
Does that mean it's counting at 1 second intervals now?That works better.
If so, then the problem is in your RX handler. If you have a Timeout value in the HSERIN statement, it sits in the interrupt until it either receives ALL the data, or it times out. Or if there's no timeout, it simply waits until it's received enough data before returning.
If that handler is a High Priority interrupt, then no other interrupts can occur until it's returned from that handler. Timer1 would then probably miss many interrupts.
By making the RX handler a Low Priority interrupt, it allows the (high priority) TMR1_INT to continue on without conflict.
<br>
DT
Bookmarks