Hey guys, I've had great success in my latest project thanks a lot to the info in these forums. I came across an odd problem while using Darrel Taylors interrupts around a Pause command I like to give my power supply time to level out so I usually put a pause 1000 or whatever near the beginning of the code before I do anything that will start to draw power. When I enable the RX_Int before the pause 1000 everything works like I want, however if I place the enable immediately after the Pause 1000, the interrupt does not work. I have already made a type of pause command that acts as a debounce while refreshing my LEDs, which I can use if needed and just refresh with blanks, but found the problem a little curious. If anyone has any knowledge on why or how to clear up whatever I'm doing I would appreciate it.
I've included the parts I think are relevant as everything works fine or not fine based on which enable line is commented out.Code:'*********From Mister_E's calculator********** RCSTA = $90 'enable serial port and cont rx TXSTA = $24 'enable TX, BRGH = 1 SPBRG = 17 '9600 baud @ -0.03% SPBRGH = 4 BAUDCON.3 = 1 'enable 16 bit baudrate '*************************************************** ;****************Using Darrel Taylor Interrupts**************************** ;----[High Priority Interrupts]-------------------------------------------- ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RX_INT, _GetData, PBP, no INT_Handler TMR0_INT, _IntCounter, PBP, yes endm INT_CREATE ;Creates the High Priority interrupt processor ENDASM T0CON = %11010010 'T0 = 8 bit, Prescaler 8 '@ INT_ENABLE RX_INT ; enable RX_INT interrupts Pause 1000 @ INT_ENABLE RX_INT ; enable RX_INT interrupts mainloop: '... goto mainloop '---[USART RX - interrupt handler]---------------------------[High Priority]--- GetData: HSERIN 1000,No232,[inbyte] hserout [inbyte] red = 1 'turn off red LED stream[counter] = inbyte counter = counter + 1 if inbyte = 13 then counter = 0 update = 1 endif No232: @ INT_RETURN IntCounter: ticks0 = 6 'preload to get 200 us count200us = count200us + 1 @ INT_RETURN
Thanks
David




Bookmarks