This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to Read values in string format through API



I am using Code Composer v6.0.1. DSP TMS320C6713.

I am using Code composer API in javascript to do interaction.

Can anyone help me out how to read values in string format ?

Let's say Expression windows in Code composer is shows value of as below mentioned

Variable       Type                             Value

ABC               Type unknown    0x0000000F

XYZ                int                                         -1

 

if "ABC" is passed through any API  then result should be "0x0000000F"

if  "XYZ" is passed through any API then result should be "-1"

if i use saveData API then results would be in specified format (Hex, octal,decimal, binary etc)

or if i use readData API then results would be in integer format.

So i am looking for API or any method which can provide me results in string format.

Thanks for helping me out in advance.

  • Hello,
    You can use javascript toString() to convert a number to a string format:
    www.w3schools.com/.../jsref_tostring_number.asp

    Thanks
    ki
  • Hi Ki,

    Thanks for response.

    My Objective is read the values in same format what it is present in Expression window.

    Reason why I need:

    Let's say ABC is enum type

     

    //Enum declaration

    typedef enum

    {

    valid,

    invalid

    }status;

     

    //Enum Object definition

    status ABC;

     

    //Value assignment to Object

    ABC = -1;

     

    As Value which is assigned to Object "ABC" is not an enum.

    As Complier decides the type of enum (Int32, Int64, UInt32, UInt64 etc)

    Hence ABC will hold the value "0xFFFFFFFF" (2's complement of -1)

    When I retrieved through API .....expression.evaluate, it provides results as 0xFFFFFFFF (integer format)

    or ....memory.saveData API then results would be in specified format (Hex, INT etc )

     

    So I am not able to retrieve the value as -1.

     

    Now as you suggested to convert value into string at my javascript, won't help me.

    Because based on representation present on Expression window, I can write logic to check whether it is 2's complement or normal data types values.

     

     

    Is there any method or API which can tell me that stored number is in 2's complement?

    or is there any method or API through I can read values in negative only ?

    or is there any method or API through I can Read values in string format ?

     

    If I get any one method or API, it will solve my problem.

    Thanks for helping me out in advance.

    Regards,

    Hitesh Jaju

  • Hitesh

    Hitesh Jaju said:
    My Objective is read the values in same format what it is present in Expression window.

    Note that the display format is configurable. There is a default type but you can configure it to whichever format you wish.

    There are javascript APIs to convert the data to whatever format you wish, such as toString, parseInt, parseFloat, etc.
     For some, it can require a bit of extra work (negative numbers);

    Note that this is all javascript. There are no special DSS APIs to read the data other than the ones you have already described. Hence stick to javascript documentation. This is also a good overview:

    Thanks

    ki