We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi guys:
here is my code ,it works in AC5, but when I change to AC6, it is dead in delay_1ms(), I have no idea why it happened:
struct bsl_data_t{ uint32_t tick_1ms;};static struct bsl_data_t g_bsl;
void TIMER16_IRQHandler(void){ if(SET == timer_interrupt_flag_get(TIMER16, TIMER_INT_UP)){ /* clear channel 0 interrupt bit */ timer_interrupt_flag_clear(TIMER16, TIMER_INT_UP); /* toggle selected led */ g_bsl.tick_1ms++; }}uint32_t get_timer_tick(void){ return g_bsl.tick_1ms;}
/* x1ms */#define GET_DIFF_TICK(last_tick) ( (0x100000+get_timer_tick()-last_tick)&0xFFFFF )#define SET_TICK(var1) var1=get_timer_tick()void delay_1ms(uint32_t xms){ volatile uint32_t tick,diff=xms; SET_TICK(tick); while(GET_DIFF_TICK(tick) < diff){} // dead in here, never come out in AC6.}
here some picture maybe help:
AC5:
AC6:
donot know why It removed line 311: