I apologize for the delay -- for some reason my email put everything into spam folder. n.b. this assembly is from invocation with no optimization. Working case: ; I code from now on! ; ; Starting pCode block S_Timer__TimerFlagRaised code _TimerFlagRaised: ; .line 126; Timer.c bool TimerFlagRaised(timer_handle_t timer) MOVFF FSR2L, POSTDEC1 MOVFF FSR1L, FSR2L MOVFF r0x00, POSTDEC1 MOVFF r0x01, POSTDEC1 MOVLW 0x02 MOVFF PLUSW2, r0x00 ; ;multiply lit val:0x05 by variable r0x00 and store in r0x00 ; .line...
I apologize for the delay -- for some reason my email put everything into spam folder. Working case: ; I code from now on! ; ; Starting pCode block S_Timer__TimerFlagRaised code _TimerFlagRaised: ; .line 126; Timer.c bool TimerFlagRaised(timer_handle_t timer) MOVFF FSR2L, POSTDEC1 MOVFF FSR1L, FSR2L MOVFF r0x00, POSTDEC1 MOVFF r0x01, POSTDEC1 MOVLW 0x02 MOVFF PLUSW2, r0x00 ; ;multiply lit val:0x05 by variable r0x00 and store in r0x00 ; .line 129; Timer.c return (g_timerEntries[timer].flag == true);...
I've found the source of the problem. In my code, I have a typedef struct: typedef struct TimerEntry { timer_event_t eventType : 4; timer_state_t state : 1; bool flag : 1; timer_value_t period, count; } TimerEntry; In another part of the code, I have the following function: bool TimerFlagRaised(timer_handle_t timer) { return (g_timerEntries[timer].flag); } This always returns true. However, if I change it to: bool TimerFlagRaised(timer_handle_t timer) { return (g_timerEntries[timer].flag == true);...
I've found the source of the problem. In my code, I have a typedef struct: typedef struct TimerEntry { timer_event_t eventType : 4; timer_state_t state : 1; bool flag : 1; timer_value_t period, count; } TimerEntry; In another part of the code, I have the following function: bool TimerFlagRaised(timer_handle_t timer) { return (g_timerEntries[timer].flag); } This always returns true. However, if I change it to: bool TimerFlagRaised(timer_handle_t timer) { return (g_timerEntries[timer].flag == true);...
I can't believe that didn't occur to me. You're absolutely right. Now to find out why...
The oscilloscope shows a 44.36 uS duration between LED toggles. On a system oscillator of 32 MHz, /4 for 8 MHz, this yields ~355 cycles. These pulses are periodically longer due to an interrupt call. This is not such a long time, and my guess would be that a flag in my code is stuck TRUE for some reason and the main loop code keeps running without interruption. What gives me pause is that the same code runs on XC8 without issue. If there's a compiler quirk I'm overlooking, I'd greatly appreciate...
I can't believe that didn't occur to me. You're absolutely right. Now to find out why... ( I imagine this means the bug is closed? )
I can't believe that didn't occur to me. You're absolutely right. Now to find out why...