EmbDev.net

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


Author: Wil (Guest)
Posted on:

Rate this post
0 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?

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 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?

Author: Schlumpf (Guest)
Posted on:

Rate this post
0 useful
not useful
typical:

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

Vin = Rshunt * I

Out = Vin * (xFFF / Vref)

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 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
Author: Schlumpf (Guest)
Posted on:

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

right :-)

Author: Wil (Guest)
Posted on:

Rate this post
0 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)

Author: Wil (Guest)
Posted on:

Rate this post
0 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.

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 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...

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.