From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-19-2020 05:35 AM
Hello All,
I am at a loss,
A simple code for controlling a digital servo is taking me days instead of hours.
I guess I do not fully understand the ins and outs of hex strings.
I need to send to the servo a string composed of headers, the data and checksum.
the checksum part is solved.
and now I am trying to dynamically build the data and header string.
the problem is the the conversion of a number that represent the desired angle, I try to concentrate the string with the headers. but it appears that the final result is empty string instead of the header. as can be seen in the attached screen shot. although the headers concentrate correctly. when I see spaces after concentrating it with the angle data.
I have attached a screen shot and the VI in 2018 version.
Thanks!
GIl,
Solved! Go to Solution.
12-19-2020 09:02 AM - edited 12-19-2020 09:03 AM
You are mixing hex and ASCII (ie "Normal") displays.
1) The Number To Hex String just converts a number into an ASCII representation of the hexidecimal value. You just want the raw value. So use Flatten To String.
2) It looks like your value should just be 2 bytes. So coerce the value to a U16 before flattening it.
3) It also appears that the value should be represented using Little Endianness. Luckily, there is an input on the Flatten To String to do this for you.
4) Make sure all of your indicators are in the correct display format. In this case, you want them all to be in "hex".
12-19-2020 09:06 AM - edited 12-19-2020 09:09 AM
And just to put it all together with your previous thread...
NOTE: You will want the CRC calculation and adding to the end in a subVI since I am sure you will be needing to do this with a bunch of different commands.
12-19-2020 09:10 AM - edited 12-19-2020 09:17 AM
You have some non printable characters which are displayed as spaces if your indicator is set to normal string. Switch it to hex and you will see your header. Conversion of the angle is wrong: I think you need that value to be converted into a binary string for which you can use Flatten to String function. From your expected result string it seems that this value should be stored using little endian order so I set it accordingly:
Edit: I did not see @crossrulz already responded.
12-22-2020 09:14 AM
Thanks!