取消
显示结果 
搜索替代 
您的意思是: 

How to convert potency values to binary data

已解决!
转到解答

Hey. 

I need to build a VI on which I input a potency value (from 0 to 300 W), and then convert this value to a 12-bit binary value, to be sent to my electronics's DAC and control the potency.

I was reading stuff about fixed point numbers, but didn't reach any solid conclusions.

Since i have 4095 numbers in a 12-bit value, I can have a precision of 0,07326 in my controls. 

To sum up, when I throw my minimal value (0 W) I want a 0000-0000-0000 byte;

When I throw my maximal value (300 W) I want a 1111-1111-1111 byte.

 

Can you guys please help me on what tools shall I use to build this? 

Thanks!

0 项奖励
1 条消息(共 9 条)
4,449 次查看

What datatype does the instrument accept? Should it be just a string of three bytes?

 

SImply scale a U32 integer to the range of x000000 to xFFFFFF (0..300), and typecast it to a string. Take the string subset of the 3 useful bytes and send it to the instrument. (you might have to worry about byte order, too).

2 条消息(共 9 条)
4,443 次查看

The instrument is a 12-byte DAC.

Shouldn't i scale a U16 integer to the range?

I am pretty new to labview, so i'm sorry for the basic answer, but this range scale you're talking about: how is it done? Properties -> Data entry?

0 项奖励
3 条消息(共 9 条)
4,430 次查看

Ah, sorry, I thought you saind 24bit. Yes, scale to 12 bits.

 

However, it is now not clear what the instrument wants, because it is typically quantized to bytes (multiples of 8 bits). You seem to have 1.5bytes here.

Does the instrument want a hexadecimal or binary formatted string? Does it want a typecast U16, ignoring one nibble?

 

 

4 条消息(共 9 条)
4,429 次查看
解答
接受人 pedroseger

pedroseger wrote:

I am pretty new to labview, so i'm sorry for the basic answer, but this range scale you're talking about: how is it done? Properties -> Data entry?


You still don't say what datatype the instrument wants. Here are some possibilities showing the scaling.

5 条消息(共 9 条)
4,418 次查看

altenbach, i'm not sure of what DAC we are using, but i believe it's something like that:

http://www.maximintegrated.com/en/products/analog/data-converters/digital-to-analog-converters/MAX57...

Anyways, I'm working with the labview part only. I just want to build a numeric entry in my front panel which produces a 12-bit value, with the precision of this value being limited by the 4095 possible values in a 12-bit. Point is: I'm pretty new to labview, so i don't even know exactly what tools shall I use to do it 😞

0 项奖励
6 条消息(共 9 条)
4,415 次查看

Yes, my example above does the scaling. You can set the display format of the numeric back to decimal to see [0 ..4095]. It is currently set to binary display.

7 条消息(共 9 条)
4,409 次查看

Well, I believe that your example cleared the path for me. I think i can do it now!

I have no words to describe my gratefulness for your help.

Thank you very much!

0 项奖励
8 条消息(共 9 条)
4,401 次查看

Of course ideally you would change the order of operations slightly and do the division by 300 on the upper wire brach.

This way the compiler can fold everything into a constant to be multiplied with the numeric value.

 

 

 

(No big deal here, though. It is even possible that compiler optimiziations will do the same on the original code)

0 项奖励
9 条消息(共 9 条)
4,360 次查看