Announcement

Collapse
No announcement yet.

Convert ASCII to Decimal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert ASCII to Decimal

    Hello, i am trying to send values from digits, but using Terminal 9600 of workshop, the value is converted in ASCII.
    For example, my digits display the value 65, I decided to send this value to the terminal, but it shows me A. And I would like to display 65

    if(para1 == 3) to(COM0); print ("Humidite"); while(reception != 72) reception := serin(); wend print([CHR] reception); pause(200); to(COM0);putch(numx4); print(numx4); while(reception != 104) reception := serin(); wend print([CHR] reception); para1 := 0; endif

  • #2


    Not sure I follow you properly, in your code you have

    print([CHR] reception);

    Which would print 'A' if reception was 65, simply saying

    print(reception);

    would print '65'
    Mark

    Comment


    • #3


      I removed [CHR] my code but nothing changes. I do not know if I've done well understand ..

      Attached files

      Comment


      • #4


        Still not sure I follow, but try changing

        to(COM0);putch(numx4);

        to

        to(COM0);print(numx4);
        Mark

        Comment


        • #5


          I sent you my code

          Attached files code.txt (8.5 KB)

          Comment


          • #6


            Sorry, still can't be sure of what you are trying to do.

            Do you want

            Temperature13Humidite70

            to print on the terminal?

            Where you have

            to(COM0);
            putch(numx4);
            print(numx4);

            assuming numx was 0x0123

            This will do this
            to(COM0); // the next print/putch, etc. will be sent to COM0
            putch(numx4); // The hex value of the lower byte (0x23) will be sent to COM0
            print(numx4); // The number 291 will be printed on the display

            HTH
            Mark

            Comment

            Working...
            X