Getting the "," in the middle


Closed Thread
Results 1 to 6 of 6
  1. #1

    Talking Getting the "," in the middle

    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.

    Code:
    debug dec2 VA,",",dec1 VA,13,10
    how can i do it with the debug command ?

    .

  2. #2
    Join Date
    Jul 2005
    Location
    Midwest
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    untested and not thought out

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

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Steve_88 View Post
    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.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve_88,skimask

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

    cheers

  5. #5


    Did you find this post helpful? Yes | No

    Default

    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:
    '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:
    Code:
    debug dec3 RA/10,",",dec1 RA//10,13,10
    Any idea ?
    Thanks
    Last edited by ruijc; - 30th March 2008 at 14:19.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hello rujic
    Last edited by Acetronics2; - 30th March 2008 at 15:06. Reason: have to read before answering !!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. RB0 + Internal Pullup + Interrupt
    By Freman in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 10th August 2009, 11:11
  2. pins in arrays?
    By scorpion in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th September 2005, 08:18
  3. pic with 3.3v
    By mischl in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2005, 18:28

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts