ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String problem

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(5,613 Views)
Solution
Accepted by topic author Vegard123

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:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(5,574 Views)

I see. 
I will try to convert it to U32. Thanks!

0 Kudos
Message 3 of 10
(5,547 Views)

 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.. 

0 Kudos
Message 4 of 10
(5,536 Views)

Hi Vegard,

 

sorry, can't open your LV2015 VI. Please downconvert to LV2011 (or LV2014)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(5,522 Views)

Why are you typecasting a string into a string?  That does nothing.  Instead, wire an U32 into the "type" input.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(5,509 Views)

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..

0 Kudos
Message 7 of 10
(5,498 Views)

Sorry, figured it out. Really simple, but not so easy when I am new to the program

0 Kudos
Message 8 of 10
(5,494 Views)

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.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 10
(5,475 Views)

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. 

Message 10 of 10
(5,440 Views)