EmbDev.net

Forum: FPGA, VHDL & Verilog Scaling to a 12-bit ADC value


von Wil (Guest)


Rate this post
useful
not useful
Hello,

I want to scale a current value(Icurr) (in Amperes) to a corresponding 
12 bit value. The to-be scaled  current value(Icurr) and a 12-bit ADC 
value(Iact) are given as inputs to a PID controller as actual(Iact) and 
expected(Icurr) values.

I am not sure how to approach the scaling.

My idea of approach is to : For example take a 1V=4A value as an input 
to ADC and find the corresponding 12bit value. Take it as reference to 
scale Icurr accordingly. But I am also not familiar reading from a ADC 
data sheet to find the approximate 12bit value for an input 
voltage/current.

Any suggestions?

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
First question:
Is your question related to FPGA, Verilog or VHDL?
If so: how?

Wil wrote:
> Any suggestions?
What hardware?

> But I am also not familiar reading from a ADC data sheet to find the
> approximate 12bit value for an input voltage/current.
What ADC?

> For example take a 1V=4A value
So you have a "device" that forms 1V out of 4A, meaning 2A result in 
0.5V?

von Schlumpf (Guest)


Rate this post
useful
not useful
typical:

Vin = Vref : Out = xFFF
Vin = 0    : Out = x000

Vin = Rshunt * I

Out = Vin * (xFFF / Vref)

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Schlumpf wrote:
> Out = Vin * (xFFF / Vref)
But the slope of this calculation is 1/4096 wrong.
But you can ignore the deviation if you want...  ;-)

For a 12 bit ADC this formula is correct: Out = Vin * (x1000 / Vref)

: Edited by Moderator
von Schlumpf (Guest)


Rate this post
useful
not useful
Lothar M. wrote:
> But the slope of this calculation is 1/4096 wrong.

right :-)

von Wil (Guest)


Rate this post
useful
not useful
Lothar M. wrote:
> First question:
> Is your question related to FPGA, Verilog or VHDL?
> If so: how?
>
Yes, I want to implement the scaling in VHDL
> Wil wrote:
>> Any suggestions?
> What hardware?
>
Altera Cyclone IV
>> But I am also not familiar reading from a ADC data sheet to find the
>> approximate 12bit value for an input voltage/current.
> What ADC?
>
LTC1407 12bit ADC

>> For example take a 1V=4A value
> So you have a "device" that forms 1V out of 4A, meaning 2A result in
> 0.5V?
Yes, A Dual Op_Amp gives out 1V=6A (seeing from the layout)

von Wil (Guest)


Rate this post
useful
not useful
Schlumpf wrote:
> typical:
>
> Vin = Vref : Out = xFFF
> Vin = 0    : Out = x000
>
> Vin = Rshunt * I
>
> Out = Vin * (xFFF / Vref)

So here to get a 12 bit value, Should I just consider Vin=1V 
(irrespective out of the 4A i.e. 1v=4A ?).

Or do I need to calculat the correspoding voltage for 4A? (V= 4*Rshunt) 
How do I find Rshunt from the datasheet?

The datasheet for LTC1407 says Vref=2.5V.

So for Vin=1 Out should be 1638.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Wil wrote:
> The datasheet for LTC1407 says Vref=2.5V.
> How do I find Rshunt from the datasheet?
Because at Imax you want full scale inputof 2.5V  for the ADC you have 
to calculate Rshunt = Imax/2.5V

Buuuuuut(!):
This will only work if you can accept 2.5V voltage voltage drop over 
your shunt...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.