__sub__g Posted August 15, 2022 Report Share Posted August 15, 2022 I want to save the month with only one character 1-9 is not a problem But 10,11,12 needs to saved as 10-O (December) 11-N (November) 12-D (December) I am using mm//dd for RTC I used function:( string to left )to find the two numbers Now I want to convert String to integer? How can I do that? Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 15, 2022 MVP 2023 Report Share Posted August 15, 2022 Under the Strings menu there's an ASCII->Num block - Joe T. 1 Link to comment Share on other sites More sharing options...
__sub__g Posted August 15, 2022 Author Report Share Posted August 15, 2022 58 minutes ago, Joe Tauser said: Under the Strings menu there's an ASCII->Num block - Joe T. Thank you so much Joe.T I was able to do it Now I want to set Mi value to O if 10 N if 11 D if 12 Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 15, 2022 MVP 2023 Report Share Posted August 15, 2022 Since O, N, and D are not sequential in the alphabet I would just use equal blocks for each and move the ASCII value of each letter into the MI. It makes the logic easier to look at for ASCII if you set the display mode to hex. For example- Joe T. 1 Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted August 15, 2022 MVP 2023 Report Share Posted August 15, 2022 One thing that might assist, but you may not know and is not obvious, is the ability to view Hex is easy. In the operand window under Format, if you left click DEC it changes to HEX. cheers, Aus Link to comment Share on other sites More sharing options...
__sub__g Posted August 16, 2022 Author Report Share Posted August 16, 2022 20 hours ago, Joe Tauser said: Under the Strings menu there's an ASCII->Num block - Joe T. I am getting an error with the conversion. Does not make sense!! Do you see any error? Mi913 is not being used anywhere else. Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 16, 2022 MVP 2023 Report Share Posted August 16, 2022 You're not telling us what the error is. Do a screenshot of it. You're putting multiple logical statements in the same network again, as you did in another post. This should be three networks. You should store your factor (MI 889) before you call your function blocks. Joe T. Link to comment Share on other sites More sharing options...
__sub__g Posted August 16, 2022 Author Report Share Posted August 16, 2022 4 hours ago, Joe Tauser said: You're not telling us what the error is. Do a screenshot of it. You're putting multiple logical statements in the same network again, as you did in another post. This should be three networks. You should store your factor (MI 889) before you call your function blocks. Joe T. Thank you so much Joe.L, like you said removing from the same ladder solved the problem. I have one problem now I have number and String, I want to concatenate them. I tried to using Num to Ascii function, but this did not do it. Eg String1=”abc” Mi 1= 100 Sting Final=”abc100” How could I do this? Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted August 16, 2022 MVP 2023 Report Share Posted August 16, 2022 This a more complicated problem. Since Unitronics Vision doesn't have string data types, you need to track where your characters are in the MI table. There is no "concatenate" function so the problem needs to be broken down to the byte level. Before you solve the problem you'll need to define your initial possible conditions. How big with the number be? How long can the string get? You'll need a block of MIs to be a buffer for your manual string manipulation. Step one is to determine the length of the string. Step two is to move the string to the beginning of the buffer. Step three is to convert the number to a string and also determine its length. Step four is to move this "number string" to the tail end of the first string using the Vector Copy with Offset function. Clear as mud, I know. Have a go at it. Joe T. 1 Link to comment Share on other sites More sharing options...
__sub__g Posted August 16, 2022 Author Report Share Posted August 16, 2022 29 minutes ago, Joe Tauser said: This a more complicated problem. Since Unitronics Vision doesn't have string data types, you need to track where your characters are in the MI table. There is no "concatenate" function so the problem needs to be broken down to the byte level. Before you solve the problem you'll need to define your initial possible conditions. How big with the number be? How long can the string get? You'll need a block of MIs to be a buffer for your manual string manipulation. Step one is to determine the length of the string. Step two is to move the string to the beginning of the buffer. Step three is to convert the number to a string and also determine its length. Step four is to move this "number string" to the tail end of the first string using the Vector Copy with Offset function. Clear as mud, I know. Have a go at it. Joe T. What does "Step two is to move the string to the beginning of the buffer" mean?? Link to comment Share on other sites More sharing options...
Gabriel Franco Posted August 16, 2022 Report Share Posted August 16, 2022 In fact there is an instruction to do it: Insert String to String Link to comment Share on other sites More sharing options...
Fernando Castro Posted August 17, 2022 Report Share Posted August 17, 2022 If the purpose is to display that on screen, I find easier to use string library to concatenate and make more complex string text based on other information: In this case I have a composite duration . I track the Hrs. as an Integer, then convert to ASCII, then link that value on String variable, Then I just select in the screen the String from library to display as an ascii : 2 Link to comment Share on other sites More sharing options...
Gabriel Franco Posted August 17, 2022 Report Share Posted August 17, 2022 I learned something new today, thanks Fernando, I didn´t know about such string library capacity to store indirect strings. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now