## Recommended Posts

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

##### Share on other sites

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

##### Share on other sites

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

##### Share on other sites

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

##### Share on other sites

Oh sure, even tested it.

Attached is the subroutine I exported

Damian

Many thanks for instrution and help. :-) Working perfectly.

##### Share on other sites

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 ?

## Create an account

Register a new account

×