augustinetez
Active Member
Not being very good in the math department, could someone point in the direction of solving an ADC scaling/conversion problem please.
Scenario (this carries across from my voltage leveling post a little while ago):-
Input to a PIC ADC using the 3.3V rails as the ADC reference.
The ADC raw values span 35 to 937
When the input voltage to the leveling circuit is at the center of it's range, the ADC value is 480
What I need to solve:-
A dead band of 5 ADC counts either side of 480 ie 475 - 485 = dead band, this could be increased slightly if it helps with calculations.
Above and below this dead band, I need to compute a number from 10 - 2500 in increments of 10 from the remaining counts (10 to 2500 above dead band and 10 to 2500 below) and also determine if it is above or below the dead band with an above/below dead band indicator bit.
The result from any calculation to = 0 when in the dead band.
This is to add/subtract from the frequency control word of a DDS chip using an existing analogue circuit.
I have spent several days trawling through this and various other forums without success.
And yes, of course, I'm still doing it all in assembler.
Scenario (this carries across from my voltage leveling post a little while ago):-
Input to a PIC ADC using the 3.3V rails as the ADC reference.
The ADC raw values span 35 to 937
When the input voltage to the leveling circuit is at the center of it's range, the ADC value is 480
What I need to solve:-
A dead band of 5 ADC counts either side of 480 ie 475 - 485 = dead band, this could be increased slightly if it helps with calculations.
Above and below this dead band, I need to compute a number from 10 - 2500 in increments of 10 from the remaining counts (10 to 2500 above dead band and 10 to 2500 below) and also determine if it is above or below the dead band with an above/below dead band indicator bit.
The result from any calculation to = 0 when in the dead band.
This is to add/subtract from the frequency control word of a DDS chip using an existing analogue circuit.
I have spent several days trawling through this and various other forums without success.
And yes, of course, I'm still doing it all in assembler.