03-02-2016 02:10 AM
Hi,
I am trying to read information from an encoder in order to control the position to a motor.
However, when I try to read the encoder information, I seem to get a hexidecimal number I can do anything with. Does anyone know what I can do to get a integer value from the encoder.
Any help would be highly appreciated
Vegard
Solved! Go to Solution.
03-02-2016 04:20 AM
Hi Vegard,
posting an image is better than just writing text. But posting a VI/snippet would be much better than a simple image!
I guess your string indicator "EncCnt" is set to "Hex Display" mode. If this is the case you should typecast the received string to an U32 value…
Or use DeserializeString:
03-02-2016 05:16 AM
I see.
I will try to convert it to U32. Thanks!
03-02-2016 05:34 AM
I tried to typecast the string, but the info I got out of it was weird I think. It did not return numbers, just weird letters..
03-02-2016 05:44 AM
03-02-2016 06:02 AM
Why are you typecasting a string into a string? That does nothing. Instead, wire an U32 into the "type" input.
03-02-2016 06:18 AM
That is what I am trying to do, I inserted Control into the type input, but I could not seem to be able to put U32 into the typecast..
03-02-2016 06:20 AM
Sorry, figured it out. Really simple, but not so easy when I am new to the program
03-02-2016 07:18 AM - edited 03-02-2016 07:18 AM
Why don't you post your solution instead of just saying you fixed it so other people can benefit from your experience?
This is a chance for you to be the teacher in a learning forum. 🙂
03-02-2016 10:57 AM
Would gladly post my solutions. Right now it is packed into quite a bit of code. But the thing was really to make a numeric constant and change the representation to U32. Then wire it to the 'type' terminal on the type cast block.
If anyone should ever be interested, this is the VI i made for rotating one rev forwards.