Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

post-1695-056680700 1316009175_thumb.jpg

Posted

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

gallery_93_13_127534.jpg

Dot2Comma.vlp

Posted

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 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.