07-09-2022 05:16 AM
hello everyone
i have one string like "trans B60A00" in this string last two numbers 00 are the hex numbers and i want to increment only hex number such as 00, 01 till 3A. and i want to increment that number using slider any one can tell me how to do it?
thank you in advance
Solved! Go to Solution.
07-09-2022 06:06 AM
What have you tried? Have you any programming experience in any Computer language that includes working with strings? How well do you understand the "string structure" of the data you are handling and hope to manipulate?
From your (very) brief description, it sounds like you have a string (fixed length? variable length?) and you want to manipulate the last two characters in the string, treating them as representing Hex numbers and wanting to do an "increment" on the number and use that as a replacement string.
Use Tutorials to learn about the LabVIEW String functions (or you can open LabVIEW, open the String Palette, look at the String functions, and read the Detailed Help on the ones whose name suggest they might be appropriate).
You basically have the following tasks:
If you want to learn LabVIEW, you need to do the homework yourself.
Bob Schor
07-09-2022 07:06 AM
i will try with your suggestions and ask you if i have any questions
07-10-2022 04:21 AM
Hi, this is working but now im facing problem to control the with the slider. I mean it should only incrementing value when slider moves. I need to set a range like 00 to 3A in this range slider will move and increment the values. when slider will move then only increment should happen. I have gone through examples on forum but not getting exact idea. can someone help me?
Thank you
07-10-2022 10:27 PM
@newmemeber123 wrote:
Hi, this is working but now im facing problem to control the with the slider. I mean it should only incrementing value when slider moves. I need to set a range like 00 to 3A in this range slider will move and increment the values. when slider will move then only increment should happen.
I, for one, do not understand what trouble you are having. Please attach the "code that partly works" (attaching the actual code, meaning a .vi file, is much easier for me to understand and, better, to test than attaching a "picture" of your Block Diagram). It should (ideally) have the "slider" you mention, and you should explain exactly what you want to do relative to the code you show us. This makes sure we aren't "answering the wrong question".
Here's a question -- have you had enough LabVIEW experience to have encountered using Event Structures to "do things" when you change the value of a Front Panel Control (like this mysterious "slider" you mention)? Incidentally, this is another "benefit to you" of attaching your code -- it provides us "clues" to your level of LabVIEW expertise so that we can provide the right level of help and explanation ("teaching", as it were).
Bob Schor
07-11-2022 12:21 AM
hello, im new here in lab-view and attaching my VI which works fine for increment only once. Now i have to modify it such as the last two hex number of the should increment from 00 to 3A(which is range for slider) using slider at front panel.( Initially number is 00 now. when slider will be move then value should increment from 00 to 3A) now im able to increment only once not in the range and not with the slider.
thank you
07-11-2022 04:04 AM
It works one time because you are searching for 00. You have to split the hex string into an array i.e. [B6,0A,00]. For example, you can use a for loop (for fixed length) or while loop (for variable length) to take off 2 characters from the string each iteration, convert to number and add them to the array. You can then manipulate just the last index of the array.
07-11-2022 04:38 AM - edited 07-11-2022 04:57 AM
Im bit confused can bit explain in detail or if you any example of it?
Thank you in advance
07-11-2022 05:42 AM
I explained a general approach to easily manipulate any of the hex numbers.
In your case you just want to modify the last 2 characters of you string. So, use 'String Subset' to take the last 2 characters, convert to number and add the value of your slider. Then convert back to string and display the full hex string.
But it is good practice to think of a general usage of your programs. Let's say you made the VI to work specifically for modifying the last 2 characters. In the future, for some reason, you want to modify the middle 2 characters. How easily would the be done with your vi?
07-11-2022 06:58 AM - edited 07-11-2022 06:59 AM
Thanks, Yes even i will try that. moreover i have decimal number which i have converted from the last two char already as you can see in the attached Vi. im just not getting how add it to the slider and set the range 0 to 3A(58 decimal). then back to hex string so i can control last two chars using slider.
Thank you