LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Third Party U 64 Control, Used bits 25 most significant

I spent the whole day at work trying to work out some calculation and the simple fact that I dont know and could not find any literature on using  x number of bits from a U64, I returned home with no results for today.
Dear Experts Please help. I have on the machine an endat encoder to measure the speed in RPM of the shaft of a motor. I used manufacturers  provided RT vi to acquire the position data. This is a 25 bit encoder so the RT vi position indicator gives a 25 bit value. This value is acquired using a U64 indicator. I found that only the most significant 25 bits are used from this U64 indicator.
This 0 to 2^25 bit value ( 0 to 33554432) corresponds to 0 to 360. The manufacturer gave the following instructions to convert it into RPM.
Timed loop period to 1000 ms Take difference of the current position value from the previous position value and divide it by 2^24 and multiply by 60.
I can read the current position. Then use the shift register on the timed loop to read the previous position value. Both are acquired using U64. When I subtract the two, the results fluctuates as below.
The difference,  some random value,   the difference,  some random value,  some random value, the difference.
I dont know why this is occuring. When I can read the current and previous position values, why the difference is not a correct value. It looks to me that it is perhaps something to do with the bits of the U64 indicator.


Any comments will be much appreciated

 Kind Regards Austin         

0 Kudos
Message 1 of 4
(2,265 Views)

@AustinCann wrote:

This value is acquired using a U64 indicator. 


An indicator typically cannot acquire any data,  so I am a bit confused. 😉 Does the driver subVI (RT.vi?) output the raw U64 with the bits in the MSB area or is the data already shifted to be aligned with the LSB?

 

It is possible that you have a problem when the value wraps between iterations. Can you show us some code?

0 Kudos
Message 2 of 4
(2,262 Views)

I think it would be sufficient to wrap the subtraction result back into 25 bits using quotient and remainder. Here's a quick draft. See if it works for you.

0 Kudos
Message 3 of 4
(2,245 Views)
0 Kudos
Message 4 of 4
(2,228 Views)