Returnint Cycles not working with my RTCC rollover
I am having trouble getting the Interrupt to cycle correctly using RETURNINT 196.
I had to put the code RTCC=196 at the end of my interrupt code. I thought the RETURNINT (cycles)
was supposed to cover that.· I tried setting OPTIONX in the device but it said it was obsolete.
I am pulsing my RTCC pin and every 60 pulses I want to increment my counter.
I set my Option to rollover enabled on RTCC pin.
I had to put the code RTCC=196 at the end of my interrupt code. I thought the RETURNINT (cycles)
was supposed to cover that.· I tried setting OPTIONX in the device but it said it was obsolete.
I am pulsing my RTCC pin and every 60 pulses I want to increment my counter.
I set my Option to rollover enabled on RTCC pin.
DEVICE SX48, OSCXT2,BOR42 FREQ 4_000_000 Counter VAR Word INTERRUPT Counter = Counter+1 RTCC=196 RETURNINT '196 'Not working {60 cycles} PROGRAM Start Start: OPTION = %10100000 'RTW=1, RTI=0, RTS=1, RTE=0, PSA=0 RTCC = 196 Main: ' main code here If RA.1 = 1 then OPTION = %11100000 ' Disable Rollover 'RTW=1, RTI=0, RTS=1, RTE=0, PSA=0 else OPTION = %10100000 'Enable Rollover 'RTW=1, RTI=1, RTS=1, RTE=0, PSA=0 endif GOTO Main
Comments
ISR_Start:
' Interrupt code here
ISR_Exit:
RETURNINT
- Sparks
Ductapemaster, that code did not help.
I did find it to work with using "Returnint 60"
I thought it counts up to 255 then rolls over.
In any case I was trying to disable the RTCC counter but my options only disabled the rollover.
This was going to be a roundabout way to disable pulse counting.
I use the following to generate steps:
TIMER1 PRESCALE, 6 ' 1:64
TIMER1 PWM, tmpW1, tmpW2 ' activate PWM
How can I disable this during runtime? I tried sending it a 0 but it locks up.
Yes "RETURNINT 60" would be correct. The compiler computes the correct adjustment to RTCC.
TURBO, OPTIONX, and STACKX are not valid for the SX48 (they are alway on).
I don't understand how using TIMER1 in PWM mode will prevent RTCC from incrementing ???
I would connect your pulse though a resistor, then connect RTCC pin to an I/O pin. When the I/O pin is an input RTCC will count, if you make the I/O pin HIGH or LOW, if will prevent RTCC from counting.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
Sorry, sorry... It looks like you are correct about OPTIONX and STACKX not being valid settings for the SX48. They are always active on the 48 and can not be disabled. Please accept my apology for presenting incorrect information.
I have now learned something I either forgot or did not know before. (I am not sure which is the actual case since I have occasionally used the SX48 by assuming these fuses were active without specifically setting them.)
- Sparks