I have uint16_t type of data from ADC conversion register, which can take value from 0 - 30000. This is after multiplication by some constant.
Now I have to print it on graph, & have to level shift from mid point so I got negative value range i.e -15000 to +15000.
What should be correct conversion method like
uint16_t val;
int16_t conv_val;
if( val > 32767 )
{
val = 32767; /* limit it for avoiding saturation as conversion to signed is needed */
}
conv_val = (int16_t)val; //is it correct way