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.

CCS: GUI V2 as master

Tool/software: Code Composer Studio

Hello! I want for GUI application runs as a master.  And it initiates sendind data to target in interval. But I never found how to do it. I can not bind any custum action ( and sending data too)  wilth refresh interval. Please explain me how to do it.

  • As I remember the out of the box demo is based on GUI.
    If you can, analyze this example.
    Based on an information you have provided it is almost impossible to help you.

    Please, provide info about your CCS version, parts of a source code in doubts.
    I do not know GUI, you need to wait for someone else to get help.
  • Hi Michael,

    • What kind of data are you trying to send to the target in the interval?
    • Are you trying to send data to the target when the custom action (button click) occur?
    • And are you trying to update some kind of GUI on an interval?

    If you can upload an example what you are trying to do, it will greatly help to see what you are trying to achieve.

    Regards,
    Patrick

  • Hello! For the prototype I took RS232 binary custom codec example from gallery. It works fine and sends data when I press buttons or shift slider or rotate circle. Sends and gets and decodes binary data to and from the target fine. All is OK. It works with solar_hv_dc_ac target project from control suite.
    But now I want to implement function wich initiates exchange from GUI but not from button, slider or any manual action but automatically with some period of time. In clear javasript it is easly to do it but how to do it in GUI? I use Code Composer Studio Version 2 as I mentioned in header of question. Please help.
  • You can create a javascript file from the File menu and add the setInterval function to get the binding value. You can use the gc.databind.registry.getBinding(...) function get the binding of your incoming stream and call getValue() or setValue() on the binding.

  • It does not work. That is part of my newfile_0.js
    newfile_0.js:
    ===========================================================================================
    myinterval=0;
    var timerId = setInterval(function() {

    myinterval++;
    ----------------------------------- This works : box changes its value accordingly to myinterval)
    templateObj.$.ti_widget_textbox1.value=myinterval;

    console.log("!!interval "+myinterval);
    }, 2000);

    document.addEventListener('gc-databind-ready', function()
    {


    --------------------This does not work- does not like token "return":
    gc.databind.registry.bind('ti_widget_textbox1.value', "myinterval", function(value){ return values.myinterval; }, function(value){ (return values.myinterval; }));

    -----------------------------This does not work- does not change value in box:
    gc.databind.registry.bind('ti_widget_textbox1.value', "targetVariable == 1 ? '1' : '2'","5");

    -------------------This does not work - does not change value in box:
    gc.databind.registry.bind('ti_widget_textbox1.value', "myinterval", function(value) { myinterval; }, function(value) { myinterval; });

    --------------------------This does not work ( does not change value in box:
    gc.databind.registry.bind('ti_widget_textbox1.value', "myinterval", myinterval, myinterval);

    });

    ================================================================================================
    Where is my fault?
  • you need to call gc.databind.registry.getBinding('widget.ti_widget_textbox1').setValue(123);

    or you can set the value in the widget directly like the way you have.
  • I want to understand system of binding Target variable and widget, this one does not work

    var timerId = setInterval(function() {
    myinterval++;
    console.log("!!interval "+myinterval);
    gc.databind.registry.getBinding('widget.ti_widget_textbox1').setValue(123);
    }, 2000);

    Error: Uncaught TypeError: Cannot read property 'setValue' of null in
    gc.databind.registry.getBinding('widget.ti_widget_textbox1').setValue(123);
  • It looks like your application didn't setup to use binding for the ti_widget_textbox1 widget, so getBinding will not work. It is perfectly fine to use the templateObj.$.ti_widget_textbox1.value = "xyz" call.