Hello.
I am using the DSP320F812 eZdsp to control 2 converters via PWM signals.
The issue is with the calibration, since the calibration is done with unsigned integers, a negative offset or small disturbance will cause the values to spin around and become positive, in this case -1 = 4095.
The gain and offset corrections are made in ADCcalibrationDriver.asm file contained in the associated files
http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=spra989a
Here is the last part of the code, where the values from the 16 channels are stored in the registers calibrated. The registers contain values from 0 - 4095
....
.loop 16 ; for ch0 to ch15 do:
MPYU ACC,T,*XAR7++ ; AH = ADCRESULTn*CalGain
SUB AH,@AR5 ; AH = ADCRESULTn*CalGain - CalOffset (Q0)
MOV *XAR4++,AH ; ch = ADCRESULTn*CalGain - CalOffset (Q0)
.endloop
I need something to hinder the spin around at negative and values > 4095, could this be done using for instance a lowest and highest value limit?
AH = ADCRESULTn*CalGain
if ( AH < lowLimit)
AH = lowLimit
elseif (AH > highLimit)
AH = HighLimit)
end
How would one write this condition in assembly code?
