То что сделал выглядить так:
CODE
#pragma inline=forced
#pragma optimize=s 9 /* this switches the maximum speed optimization for this function only */
void delay(uint8_t delatTime) /* delay routine */
/*------------------------------------------------------ */
{
if(delatTime> TIME_0) /* we do delay on base on the dwell time */
{ /* no branch - 2 clock cycles to this point */
if(delatTime> TIME_1)
{ /* no branch - 4 clock cycles to this point */
if(delatTime> TIME_2)
{ /* no branch - 6 clock cycles to this point */
if(delatTime> TIME_3)
{ /* no branch - 8 clock cycles to this point */
if(delatTime> TIME_4)
{ /* no branch - 10 clock cycles to this point */
if(delatTime> TIME_5)
{ /* no branch - 12 clock cycles to this point */
if(delatTime> TIME_6)
{ /* no branch - 14 clock cycles to this point */
if(delatTime> TIME_7)
{ /* no branch - 16 clock cycles to this point */
if(delatTime> TIME_8)
{ /* no branch - 18 clock cycles to this point */
if(delatTime> TIME_9)
{ /* no branch - 20 clock cycles to this point */
if(delatTime> TIME_10)
{ /* no branch - 22 clock cycles to this point */
__delay_cycles(2);
}
}
}
}
}
}
}
}
}
}
}
}
#pragma optimize=s 9 /* this switches the maximum speed optimization for this function only */
void delay(uint8_t delatTime) /* delay routine */
/*------------------------------------------------------ */
{
if(delatTime> TIME_0) /* we do delay on base on the dwell time */
{ /* no branch - 2 clock cycles to this point */
if(delatTime> TIME_1)
{ /* no branch - 4 clock cycles to this point */
if(delatTime> TIME_2)
{ /* no branch - 6 clock cycles to this point */
if(delatTime> TIME_3)
{ /* no branch - 8 clock cycles to this point */
if(delatTime> TIME_4)
{ /* no branch - 10 clock cycles to this point */
if(delatTime> TIME_5)
{ /* no branch - 12 clock cycles to this point */
if(delatTime> TIME_6)
{ /* no branch - 14 clock cycles to this point */
if(delatTime> TIME_7)
{ /* no branch - 16 clock cycles to this point */
if(delatTime> TIME_8)
{ /* no branch - 18 clock cycles to this point */
if(delatTime> TIME_9)
{ /* no branch - 20 clock cycles to this point */
if(delatTime> TIME_10)
{ /* no branch - 22 clock cycles to this point */
__delay_cycles(2);
}
}
}
}
}
}
}
}
}
}
}
}
Я думаю что задержка с резолюции из одного цикла можно сделать с lookup table но не могу понять как ее построить в IAR.
Буду благодарен если поделитесь как Вы делаете задержки без използование таймера.