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

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 项奖励
91 条消息(共 129 条)
1,607 次查看
Changing the input type to U64 fixes all the problems. 高兴表情
0 项奖励
92 条消息(共 129 条)
1,603 次查看
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 项奖励
93 条消息(共 129 条)
1,599 次查看

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

Hint: type in 70,000

 

0 项奖励
94 条消息(共 129 条)
1,595 次查看
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 项奖励
95 条消息(共 129 条)
1,591 次查看
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 项奖励
96 条消息(共 129 条)
1,582 次查看
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 项奖励
97 条消息(共 129 条)
1,570 次查看


@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.眨眼表情  Also, constants that were working just find in one version of the code suddenly change to something else in later versions.
0 项奖励
98 条消息(共 129 条)
1,559 次查看

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 项奖励
99 条消息(共 129 条)
1,555 次查看

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

0 项奖励
100 条消息(共 129 条)
1,549 次查看