[SOLVED] How can I use emScript to convert hex value to decimal value?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] How can I use emScript to convert hex value to decimal value?

    Hello,

    I would like to create a small javascript function to add two hexadecimla numbers. I do know that this is possible in javascript doing

    JavaScript Source Code

    1. var res = parseInt("0x01",16) + parseInt("0x02",16)
    However, when running that in the javascript code within segger I get that the varriable res is undefined and I don't understand why.



    Can someone let me know why is this happening?



    Thanks!
  • Hello,

    Thank you for your inquiry.
    Such an issue is not known to us.
    When using your Code in our emScript example from the Embedded Studio example we get no compile errors.
    studio.segger.com/index.htm?ht…com/emScript_examples.htm

    Edit:
    Great to hear that you are up and running now.
    We will consider this thread as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support contact us per e-mail.
    The following contact form can be used for this: Contact Us