04-24-2015 07:04 AM
Hello
I read current from NI 9208 (in A). I multiply it by 1000 to get mA and send it to the code you see below. I want the case structure to run when I have more than 4 mA. If I don't, I want the FT04 (indicator) to show 0 (the false case just got a 0 constant wired to the FT04). The code does what I want, but I can't seem to get decimal numbers out to FT04 (indicator). I get 15 instead of 15,4 (just an example). Am I missing something?
04-24-2015 07:11 AM
Who knows what could be happening with that Dynamic Data Type. Can you show more of your code?
04-24-2015 07:21 AM
Yes of course I can. Wasnt sue how much I needed to show you.
Don't mind all the other wires going down. It just other signals from DAQ assisstant. All of them goes to different case structures.
1. Mulitply by 1000
2. Check if its over or under 4
3. Substract 4 and multiply by 6,25
4. Sends it to the indicator.
I tried to set a indicator inside the case structure. And it showed decimal numbers. But the one outside of the structure wont. The indicator placed inside the structure were a cope of the one outside.
04-24-2015 07:26 AM - edited 04-24-2015 07:27 AM
Hi ojb,
check your wires!
After the case structure you have a thin blue wire, which denotes any type of (scalar) integer. You will never ever get decimals from an integer…
Btw. there are a lot of coercion dots: they all have a purpose/reason!
Wasnt sue how much I needed to show you.
To comment this sentence: You need to show that other case too…
04-24-2015 07:35 AM
Thanks. I figured out the problem. The false case was the problem. The 0 were not a double, didn't think it would matter. But it did I guess...
Next time I will post everything. I have learned my lesson.
Thanks again!
04-24-2015 07:37 AM
Plenty has been written here about not using DAQ Assistant and Dynamic Wires. They hide too many details and ultimately take control away from you, the (Virtual) Instrument Designer. It appears, here, that the DAQ Assistant has set the data type as Integer (probably I32, but possibly I16) and has wired this into the Dynamic wire. Usually when you multiply an Integer by a Float, you not only get a Coercion dot (the red dot on an input) telling you one input's type has been coerced (or "forcibly convert") to another type, but it is the Integer being coerced to Float, so the answer becomes Float. Here, you'll notice, the Float is being coerced (to Integer), so you are really not multiplying by 6.25, but by 6.
Get rid of the DAQ Assistant (read this White Paper) and bring your data out as "regular wires". Now, if you specified I16 outputs (because that is what your device produces), the coercion when you multiply by 6.25 will coerce to a Float, and you'll get the "answer you expect" (instead of "the answer you asked for" with the Dynamic Wires).
Bob Schor
04-24-2015 07:42 AM