Charles, Thanks for the suggestion, that's working better. How do I make TMR3 faster? It seems to check the interupt at about 76 hz, I'd like to be around 350 hz? Is there a way to do it without messing up TMR1 that I'm already using? I'm figuring 350 hz because the switch will open/close at about 44hz, but it only stays closed for about 45 degrees or 1/8 of the time. So 44hz=22.7ms, 1/8 of 22.7ms = 0.00284 s, .00284 s = 352 hz. I'm using a 20Mhz XTAL, here are some of my other settings:
For reference here is how I count number of times the switch closes, my version of what you posted, seems to work good.Code:asm __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2L ,_BOR_ON_2L & _BORV_2_2L endasm 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 TMR1_INT, _ClockCount, PBP, yes INT_Handler RX_INT, _Check_Command, PBP, yes INT_Handler TMR3_INT, _CheckWind, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE TMR1_INT @ INT_ENABLE RX_INT @ INT_ENABLE TMR3_INT
Let me know where I should modify, Thanks again for the help.Code:CheckWind: If Wpin = %1 Then WindThsState = %1 Else WindThsState = %0 EndIF If WindThsState <> WindLstState Then 'Spinning WindCnt = WindCnt +1 ENDIF WindLstState = WindThsState @ INT_RETURN
Shane




Bookmarks