Hi TI community members,
Please explain Line 305 and Line 309 in my code and please verify though CCS. The variable yk doesn't show either 1 or -1 in any case if input 0Volt and 3Volt is applied separately. I couldn't figure out the problem after using breakpoints at line 309. Please see the expression window and watch yk results in the pictures below,
Since
Line 305-> Voltage1[ConversionCount] = AdcRegs.ADCRESULT0 >>4;
Line 309 gives yk-> yk = ((float) AdcRegs.ADCRESULT0 - 2048.0f) / 2047.0f;
As we know from line 305. Voltage1 is an array[0-9] which will become equal to 0 at 0Volt input (ADCINA0) is applied. Similarly if Voltage1 [0-9] will become equal to 4095 at 3Volt input (ADCINA0) is applied.
In this way, line 309 must have two extreme values yk = +/-1 by calculating, which I don't see in the expression window. Please suggest the answers for this issue.
(Remember Voltage1 is updating the results from 0-9 bitwise when I use breakpoints setup and debug it each time)
Pictures are attached below:
Picture1 :
Picture2:
Thanks
Kind Regards
Arsalan