Formating numeric values to text


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

    Default Formating numeric values to text

    Hi there
    Wonder if someone can give me advice:
    I have a counter running that i use for in a RTC, i then send out the data as a serial string on my com port. the problem is that i need it to be the same length all the time.
    Eg: from 0 to 9 #seck gives out 0 to 9, i need it to be 01,02, ect
    from 10 onwards it is fine always 2 digits.
    I use this in a few places in my program

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If for example...

    Seconds=3
    Minutes=7
    Hours=4

    then using the formatting string... #Hours,":",#Minutes,":",#Seconds

    ... would normally give you 4:7:3

    but if you use... DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds

    then you will get... 04:07:03

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thank you, that fixed the problem

Similar Threads

  1. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 04:35
  2. Looking at pic basic pro symbol values in mplab 8.15a simulator
    By ukemigrant in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th May 2009, 13:18
  3. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  4. Numeric Values
    By Armando Herjim in forum General
    Replies: 8
    Last Post: - 28th June 2006, 01:54
  5. Melanie Olympic Timer -> Banner....scroll text...
    By jorge in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th November 2004, 22:11

Members who have read this thread : 1

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