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.

GUI Composer: Problem when plotting an array using a line graph

Hi,

I am trying to plot an array using a linegraph tool in GUI Composer.

I have defined two variables in C:

volatile int scalar = 9;
volatile int table[3] = {1, 3, 7};

and then I bind the first one in .js:

        gc.databind.registry.bind('widget.linegraph.series_0_values', 
        // dependant
        {
            value: 'program.scalar',
        },
        // getter 
        function(inputs) 
        {
            var string = "";
            for (var i=0; i<3; i++)
            {
                string = string + ',' + inputs.value;
            }
            return string;
        },
        //setter
        {}
    );

everything seems perfect:

but when I try to do a similar thing with "table":

        gc.databind.registry.bind('widget.linegraph.series_0_values', 
        // dependant
        {
            value: 'program.table',
        },
        // getter 
        function(inputs) 
        {
            var string = "";
            for (var i=0; i<3; i++)
            {
                string = string + ',' + inputs.value[i];
            }
            return string;
        },
        //setter
        {}
    );

I get an empty graph with a red cross on the left (but very shortly thus not visible below):

Could you please help me with this?

  • Can you export to archive and share your GC solution?

  • Is this you are asking for?

    guiproblem.zip

    Now, I can see a "stable" problem with missing identifier:

  • Is this you are asking for?

    guiproblem.zip

    Yes, exactly. Thank you. I will take a look shortly

  • Have you maybe found something? Slight smile

  • Now, I can see a "stable" problem with missing identifier:

    I see this too. When I inspect the symbols in the "DiodeFlashing.out" file, I see "scalar" but not "table". Are you sure that the the executable has a global array "table"?

    When looking at the app_0.js file, I see you are doing the binding there. You are doing some string concatenation for the scalar binding and returning a string. For the line graph, you should be just returning the value not as a string. You can do the binding via the GUI in the properties for that line graph. I assume you are doing this as a test to see if concatenating multiple values and returning it as a string in a js file would work since your main goal is to get this working for multiple elements in an array to try to plot all elements of the array on one line graph. Hence you read each element and then concatenate to a string that you try to pass to the line graph. I'm not sure this is supported. I'll need to follow up with engineering.

    Thanks

    ki

  • I experimented with my own simple application I created and defined these globals:

    volatile int scalar = 9;
    volatile int table[3] = {1, 3, 7};

    Then I used this the application for your GC solution. I see both Scalar and Array line graphs plotted correctly:

    Ignore that the binding for the other widgets failed. I didn't bother accounting for those, only the scalar and table variables.

    It looks like it worked fine. Hence I suspect there was some issues with your "table" array in your application.

    ki

  • You can do the binding via the GUI in the properties for that line graph

    For a line graph you can just do the binding in GUI for both the scalar and array value. Both should be supported. 

  • Thank you very much for your support!

    It's weird because I made a completely new CCS project with this code only:

    volatile int scalar = 9;
    volatile int table[3] = {1, 3, 7};
    
    int main(void)
    {
    	return 0;
    }

    and I bind "table" here for a line graph:

    and I have still the problem: missing identifier: table

    When I inspect the symbols in the "DiodeFlashing.out" file, I see "scalar" but not "table"

    Maybe it is a stupid question, but how can I inspect the file to check if the variables are here or not?

  • Maybe it is a stupid question, but how can I inspect the file to check if the variables are here or not?

    Use CCS IDE. Start a debug session and load the program. Use the Expressions view or Modules view to see if the table array is in scope.

    Make sure optimization for your project is disabled or the compiler may remove the variables that are not being used from your application.

  • Yes, indeed. It was the problem, the array table (but not scalar) was removed by the compiler. I used volatile but it was not enough, as it turned out. However, on the other hand, my optimization level is "off":

    Hence you read each element and then concatenate to a string that you try to pass to the line graph. I'm not sure this is supported. I'll need to follow up with engineering.

    I checked it now, when table is visible and this works (e.g. each element raised to the second power) :

    gc.databind.registry.bind('widget.linegraph3.series_0_values', 
        {value: 'program.table'},
        function(inputs) 
        {
            var string = "";
            for (var i=0; i<3; i++)
            {
                string = string + Math.pow(inputs.value[i],2) + ',';
            }
            return string;
        },
        {}
    );

    Once again, thank you for your help!