Hello, guys! I really need your help. I have a fpga MAX10 10M50DAF484C6G Development Kit and I want to write a code in verilog or vhdl so that when I move the potentiometer to light different LEDs. For example, if my potentiometer is at 0.5V, my LED 1 will light up, if it is between 0.56-1 V, my LED 2 will light up and so on. In total I have 5 LEDs. The max value is 2.5V. I read a lot about ADC. I know that there is a formula that calculates the conversion from analog to digital, more precisely Digital Code = Vin / Vref) × 2 ^ 12 where Vin is the voltage from the potentiometer and Vref is 2.5 V, but I don't know how to implement it in verilog or vhdl. Can someone help me?
You could make use of the threshold feature for each ADC channel to provide an indication on an additional IP interface of when a particular voltage is hit.
As for measuring the exact voltage, the easiest formula is ((digital value x (full scale voltage/4096)) - (full scale voltage/4096)). You need to subtract 1 step (LSB) because full scale (0xfff) is actually 1 step lower, which is common with ADCs. So for a 2.5 V range (without using the extra prescaler) each step is 610.35 uV.
Since there are no feedback for this thread, I shall set this thread to close pending. If you still need further assistance, you are welcome reopen this thread within 20days or open a new thread, some one will be right with you.