Decimal values from string


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    36

    Default Decimal values from string

    Hi .
    For many reason I can't use Hserin Timeout,Label,[dec par1,dec par2,dec par3] .
    I have my serial input routine that receive ascii caracters and put them in a buffer.
    There is a way to convince HSERIN to get data from buffer instead of serial port.
    Or someone has a routine that scan the buffer and return the decimal values.

    Regards
    Gianni

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    This is a way to the basics of digital calculation and base-conversion....

    Why don't test your mind ?

    Take a digit out of the Buffer (ASCII),
    subtract "0" ($30),
    take your Dummy-Variable, multiply it by 10, add the result from the last action...

    Loop until there is an End or so....


    f.eg.: (Quick and very dirty!)

    Dummy=0
    I=0
    TakeThem:
    Digit=Dummy[I]-$30:I=I+1
    If (Digit>0) and (Digit<10) Then Dummy=Dummy*10+Digit:Goto TakeThem
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Similar Threads

  1. How about String Variables?
    By mytekcontrols in forum PBP Wish List
    Replies: 40
    Last Post: - 20th January 2015, 12:53
  2. Embedded Strings in your Code Space
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 9th March 2008, 07:50
  3. hex ascii help please
    By ffr58kk90 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 29th December 2006, 21:09
  4. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39
  5. Reading Array values into variables
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 21st March 2005, 10:30

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