vibodha
Newbie level 6
- Joined
- Jun 3, 2013
- Messages
- 11
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,365
In my program, I measure the Maximum and minimum digital value form a LDR input. Then display Max, Min and the difference of Max and min this.
But it shows a wrong answer for the difference.
example
Max = 722 and Min = 400; Difference = 326 (displayed value) but the correct one is 322
Please help me
use 16F887
the cord segment is
But it shows a wrong answer for the difference.
example
Max = 722 and Min = 400; Difference = 326 (displayed value) but the correct one is 322
Please help me
use 16F887
the cord segment is
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 unsigned int Min_ADC_Value,value,Max_ADC_Value,ADC_Value,DOP; ///////////////////////////////////////////////// Finding Min and max Max_ADC_Value = ADC_Get_Sample(0); Min_ADC_Value = ADC_Get_Sample(0); while(j<145) { j++ ; ADC_Value=ADC_Get_Sample(0); if (Max_ADC_Value<ADC_Value) { Max_ADC_Value=ADC_Value; } else if(Min_ADC_Value>ADC_Value) { Min_ADC_Value=ADC_Value; } delay_ms(500); } //////////////////////////////////////////////////// DOP=Max_ADC_Value- Min_ADC_Value; // this value converted to char and display with Max_ADC_Value and Min_ADC_Value on LCD
Last edited by a moderator: