Home Forums HTBasic Forum Parse Alphanumeric String

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9340
    JSOTO211
    Participant

      Hello!

      I have been attempting the following three steps:
      1.- Capture a Alphanumeric string from a I/O port.
      2.- Pull the first 15 values of that string and discard the rest.
      3.- Save that value to be used further down the code multiple times.

      DIM Ref$[15]
      ENTER @Meter;Ref$
      WAIT 1
      Ofst=Ref$[0;15]
      PRINT ” METER READS : “;Ofst;” at 1 Vdc Range”
      PRINT

      I have attempted different variations of this section of the code and the best that I have been able to get is…
      METER READS: +0 Vdc at 1 Vdc Range

      Now the typical Alphanumeric string pulled from the I/O port is in the next form….
      +1.84280000E-05 VDC,2004,11,21,14,54,33.104,1008,0
      I seem to be unable to find the correct set of statements and commands to achieve my purpose.
      Can anyone help me out?

      Please bear with these questions, I am learning HTBasic as I go and how to code at the same time.
      Thank you.

      • This topic was modified 5 months, 1 week ago by JSOTO211. Reason: Changed the DIM statement
      #9342
      precaud
      Participant

        Assuming you want the value in a REAL (I’ll call it Rval):
        1. Dimension Ref$ large enough to capture the entire output string
        2. Capture it
        3. Then ENTER Ref$;Rval
        That should do it.

        #9344
        JSOTO211
        Participant

          Yes, I meant to state DIM as…
          DIM Ref$[55]… and not DIM Ref$[15]…The first one would capture the entire string.

          I will attempt your suggestion however I am wondering if it will capture all the real Numbers on that string and not just the first 15 characters.

          Thank you for your help.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.
        Scroll to Top
        HTB icon

        Please Sign In