DSP algorithm for DAC input variation

Maitry07

Full Member level 2
Joined
Jun 29, 2022
Messages
130
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,165
Hello,
My digital data range is dynamic range is 0033 H to 1013 H. Now This digital data is going at the input of 16 bit DAC - 5754R having a output voltage range is 0 to 5 V. So, I change the scale of 0033 H to 1013 H to 0000 H to FFFF H. so that my DAC output range is 0 to 5 V for all 4 channels. My each individual DAC channel is being updated with 1 MSPS DAC interface update rate. so, one by one my each DAC channel is getting updated.

Now I wanted to add one more algorithm such as comparison algorithm that can compare the current 16 bit digital data for channel 1 with the previous 16 bit digital data and if both data are same or else if there are +/- 2 bit variation , then the comparison algorithm will not generate any new output and As DAC 5754R will hold the old output as far as there is no output generation from comparison algorithm and latch the output based on the same old data.

This comparison algorithm need to be added at the output of scaling algorithm . Could you suggest what could be the suitable method to implement comparison algorithm?

Awaited your response.
--- Updated ---

One more thing, As This comparison algorithm need to simultaneously compare the all 4 data input with the previous one for all 4 DAC channels and comparison algorithm need to provide only that specific new output for that specific channel which are being changed from the previous one.
 

For each channel, compare the current digital data with the previous data.
Use the following logic:
for (int channel = 0; channel < 4; channel++) {
// Assuming currentData is the new input array for the current values
int currentValue = currentData[channel];
int previousValue = previousData[channel];

// Compare values
if (currentValue != previousValue && (abs(currentValue - previousValue) > 2)) {
// New value is significant enough to update
outputData[channel] = currentValue; // Update output data for DAC
previousData[channel] = currentValue; // Update previous data
} else {
// No significant change, hold old output
outputData[channel] = previousValue; // Maintain old output
}
}
 

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…