LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a normal number to binary?

Ok you are right the probe does not read correctly, however the output string is still incorrect.

Is it safe to up the data type on the control? It cannot accept the number 120,000?

If you type in 30,000 the output should be 75 30

The output Actually is 0B B8

 

Why is that?

 

0 Kudos
Message 91 of 129
(1,471 Views)
Changing the input type to U64 fixes all the problems. Smiley Happy
0 Kudos
Message 92 of 129
(1,467 Views)
But isn't the speed supposed to be divided by 10. In the example in the manual, to set the speed to 20,000, the value of 7D0 (2000) is sent. To set the speed to 30,000, a value of 3000 (BB8) should be sent.
0 Kudos
Message 93 of 129
(1,463 Views)

Yes. but it only works when the control is U64.

Hint: type in 70,000

 

0 Kudos
Message 94 of 129
(1,459 Views)
Okay, you need to change the representation for high speeds though u64 is probably overkill. That still doesn't explain why setting the speed to 20000 or 30000 does not work.
0 Kudos
Message 95 of 129
(1,455 Views)
As mentioned in one of my first replies, the speed control probably needs to be I32 and the division by ten is needed to bring the value into the valid range for an I16 number. (U64 is definitely overkill!)
 
If you do it right, there should not be any coercion dots anywhere!
 
Also, all these calculations belong inside the case structure (except maybe the control itself), because if you don't need these results in the current iteration it does not make sense to calculate them. 😉
 
Here's a quick draft on how things could look like.
 
 

Message Edited by altenbach on 08-02-2007 12:28 PM

0 Kudos
Message 96 of 129
(1,446 Views)
Really minor, but I think I would replace the Quotient & Remainder with a divide, and you could even use a floating point type for the speed control. The way it is displayed in Altenbach's latest post, you could see slight unexpected behavior. If you entered 199 as the speed, the floor of the quotient would be 19 and the motor would be told to go 190rpm assuming it multiplies by 10. If you use the divide, it would be 19.9 which would be 20 when converted to an I16 and the motor would receive a command to go 200rpm (it's more correct than 190 considering you told it 199).

Is this really the longest thread ever? It's certainly the fastest growing one I've ever watched.

Chris
0 Kudos
Message 97 of 129
(1,434 Views)


@C. Minnella wrote:
Really minor, but I think I would replace the Quotient & Remainder with a divide, and you could even use a floating point type for the speed control. The way it is displayed in Altenbach's latest post, you could see slight unexpected behavior. If you entered 199 as the speed, the floor of the quotient would be 19 and the motor would be told to go 190rpm assuming it multiplies by 10. If you use the divide, it would be 19.9 which would be 20 when converted to an I16 and the motor would receive a command to go 200rpm (it's more correct than 190 considering you told it 199).

Is this really the longest thread ever? It's certainly the fastest growing one I've ever watched.

Chris



Well, that's what happens when the programmer doesn't following all the instructions provided in earlier replies and the errors just extend and propagate.Smiley Wink  Also, constants that were working just find in one version of the code suddenly change to something else in later versions.
0 Kudos
Message 98 of 129
(1,423 Views)

Ok so "the programmer" who DIDN'T write that math btw, does have another question.

I looked at the response from the Controller, because im trying to pick out the measured values i want to read.

So I made the attached VI, but the numbers dont work. The thing that converts them from a string to and array transfer then into ascii?

So when i go to push the two bits of the single number back together, The numbers dont work out right.

What did I do wrong here?

 

 

 

 

 

0 Kudos
Message 99 of 129
(1,419 Views)

Check the representation of your indicators! They are all U8.

0 Kudos
Message 100 of 129
(1,413 Views)