PDA

View Full Version : Getting the "," in the middle



ruijc
- 23rd February 2008, 21:17
Hi all,

i'm trying to separate a value with a "," .

I have a sensor input value that is stored with 3 digits (xxx) into the eeprom but when exporting using the debug command i need to have the xx,x format.

In the manual i found the DIG command but i'm not getting it to work together with the debug command.

The DEC2 works with the debug command but this is not the right choice for this i think.



debug dec2 VA,",",dec1 VA,13,10


how can i do it with the debug command ?

.

Steve_88
- 23rd February 2008, 21:25
untested and not thought out ;)

debug dec2 VA/10,",",dec1 VA//10,13,10

skimask
- 24th February 2008, 01:28
untested and not thought out ;)
debug dec2 VA/10,",",dec1 VA//10,13,10

The above post works fine...
Here's another version of the same thing, again, documented in the PBP manual...
va = 54321
debug (va dig 5), "," , (va dig 4) , "," , (va dig 3) , "," , (va dig 2) , "," , (va dig 1) , "," , (va dig 0) ,13 , 10

output would be
5,4,3,2,1

I'm sure you could modify the above to get what you want.

ruijc
- 24th February 2008, 09:29
Thanks Steve_88,skimask

about the DIG command i wasn't using the () ... :( that's why it didn't worked

cheers ;)

ruijc
- 30th March 2008, 13:51
Hi all,

i recently descovered a little bug in my code.

The result value was working just fine and i was getting it in the xx,x format.
This works well until i reach 99,9ºC. After this i get the 4th digit in and the result ( instead of 110,5ºC for example ) is 10,5ºC .

This is due to the way the code is handling the value and sending it out.



'code for AD
adcin temp,va
tempe=(va*/2500 )>>2

'code to output value retrieved from eeprom
debug dec2 RA/10,",",dec1 RA//10,13,10


How can i get the "," in there with 3 digits but keeping it when it reaches the 4th ?


EDIT:

This is what i i'm thinking:


debug dec3 RA/10,",",dec1 RA//10,13,10


Any idea ?
Thanks

Acetronics2
- 30th March 2008, 15:03
Hello rujic