User manual

STice features UM0036
282/385 Doc ID 7705 Rev 11
Figure 216. Bottleneck detection: bottom level
static unsigned int result=0;
unsigned int Speed = 100;
unsigned int computeOutputValue(void)
{
static const unsigned int SinTab[] = {
(unsigned int) (MIN_SINUS_VALUE+0.500000*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.654508*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.793893*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.904508*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.975528*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+1.000000*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.975528*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.904508*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.793893*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.654508*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.500000*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.345492*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.206107*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.095492*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.024472*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.000000*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.024472*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.095492*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.206107*SINUS_AMPLITUDE),
(unsigned int) (MIN_SINUS_VALUE+0.345492*SINUS_AMPLITUDE)
};
#define SIN_TAB_SIZE (sizeof(SinTab)/sizeof(SinTab[0]))
static unsigned int Index = 0;
Index++;
if (Index >= SIN_TAB_SIZE) Index = 0;
return SinTab[Index];
}