JohnnyB Posted September 14, 2011 Report Posted September 14, 2011 Hi guys. I'm using a function Num to string in format "00000.000". Is possible replace the .(dot) sign for use ,(virgule) sign ? I try use function "replace string", but i don't find in a MI the "dot" value. It's correct this step ? Good Day for all
Damian Posted September 14, 2011 Report Posted September 14, 2011 "Num to String" or "Num to Ascii"? If you are using an MI you could only possibly have 5 digits in your number 00.000 since the max value of an MI is 2^16. Assuming you are using num to Ascii, you could just alter the high byte of the second MI in you ASCii array. So if you went Num to Ascii into for example MI20, since the characters are byte packed your "." will be in the high byte of MI21 assuming you always keep it to three decimal places. First do an AND with MI21 with hex 0F to "erase the "." and then just ADD hex 2C00 to MI21.
JohnnyB Posted September 14, 2011 Author Report Posted September 14, 2011 "Num to String" or "Num to Ascii"? If you are using an MI you could only possibly have 5 digits in your number 00.000 since the max value of an MI is 2^16. Assuming you are using num to Ascii, you could just alter the high byte of the second MI in you ASCii array. So if you went Num to Ascii into for example MI20, since the characters are byte packed your "." will be in the high byte of MI21 assuming you always keep it to three decimal places. First do an AND with MI21 with hex 0F to "erase the "." and then just ADD hex 2C00 to MI21. Mr Damian I confuse the function names. You are correct, is Num to Ascii Is possible you send me a example that you explain, please ?. I don´t found in help or example how use function " Replace String". Many thanks.
Damian Posted September 14, 2011 Report Posted September 14, 2011 Mr Damian I confuse the function names. You are correct, is Num to Ascii Is possible you send me a example that you explain, please ?. I don´t found in help or example how use function " Replace String". Many thanks. Oh sure, even tested it. Attached is the subroutine I exported Dot2Comma.vlp
JohnnyB Posted September 14, 2011 Author Report Posted September 14, 2011 Oh sure, even tested it. Attached is the subroutine I exported Damian Many thanks for instrution and help. :-) Working perfectly.
JohnnyB Posted September 15, 2011 Author Report Posted September 15, 2011 Damian Many thanks for instrution and help. :-) Working perfectly. Damian You wrote : "Obviously this method would need to be modified if you change the decimal place."add In the example, the vector size is 7 (D#7), (Function Number to AscII).. If i change to 8 (D#8), the function need too be changed to, right ? I try understant what is the " 00FF" in the function AND. I believe it is about bit address or bit reference. What documentation i need read and studing for understand this ?
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