This content has been marked as final. Show 2 replies
wouldn't it be better to divide the 12-bit ADC_Value by 16 to get the 8-bit DAC_Value?
DAC_Value = ADC_Value >> 4;
- Bob's suggestion seems to be a better way of doing it. A right shift by 4 positions will produce the result that you need.
- If your intention is to view the dat out on the UART, sprintf would be the ideal way to do it beacuse you have the data already in ASCII format that can be printed.
- Since your intention is to write the data a DAC directly, you can either typecast the data as uint8 or you could right shift the 12 bit dat by 4 bits.