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 data display

Hello,

I'm trying to develop a GUI in CCS. The sampling frequency of my program is 2kHz and the variables that I want to display are sinusoidal signals in the range 0-100Hz. At the beginning I tried to use LineGraph widgets with arrays of 128 elements and it worked partially, but since I need to display 10 signals the memory in the target device is not efficiently used (actually it ran out of memory). Also, I was not able to display enough periods of the sinusoidal signals.  Then I was thinking to use ScalarLine Graph widgets but because the refreshing time of the GUI is 1s (or up to 200ms by using the solution in  http://processors.wiki.ti.com/index.php/GUI_Composer/Debugger_Refresh_Rate) the data is not properly displayed. As far as I understand is because the GUI refresh the data each 200ms and the sinusoidal signals look more like random numbers. So I was thinking if there is a way to send data from the target to the GUI at higher rates (some kHz), maybe store that data in a buffer or variable in the host computer or host GUI and then read and display that computer stored variable on the GUI.

I have not set up any particular communication protocol between the computer and the target, only the default configuration via the Texas Instruments XDS100v2 USB Emulator. My target device is a F28377D dual core  device.

Any suggestion and/or advice is more than welcome since I'm not an expert on MCUs 

Many thanks in advance.

Regards,

Danilo

  • Hello Danilo,

     

    Here is what I understood from your post. Let me know if it is correct.

    -          you have limited memory on the target – let’s say an array with 200 words plus few additional words.

    -          you are sampling 10 variables 2000 times a seconds.

    -          you want your user to see the data of these 10 variables in 10 graphs with 200 points but in a continuous mode – all points in the arrays are continuously sampled. You want him to see clear sin functions instead of random dots.

     

    Considering the slow transfer rate I can try to define a scheme that will try to satisfy these, but it will assume other tradeoffs. Can you let me know if these tradeoffs are acceptable, before I go ahead and experiment with the idea?

    -          Each graph cannot be updated every 200 ms. We will try to cycle them as fast as we can, but assuming the fastest refresh rate it 200 ms that means that each graph will be updated every two seconds or so. The data in the graph will be continuous, but there will be big chunks of data, never displayed to the user. The graph for variable one will display samples from 0.000s to 0.200s but will never display variable one samples from 0.200s to 2.000s.

    -          All graphs will not be able to show sampled data at exactly the same time. Since all samples cannot be stored in the target memory, we first store samples of variable one for the first 0.2 seconds, transfer it to the host, store variable two for the next 0.2 seconds, transfer it at the host, etc. At the end: graph one with show continuous data from time 0.000s to 0.200s, graph two will show data from time 0.200s to 0.400s , graph three will show data at time 0.400s to 0.600s, etc. graph ten will show data at time 1.800 to 2.000s. then we start updating graph one again at time 2.000 seconds to 2.200 seconds.

     Will solution with these tradeoffs be acceptable to you?

     Dobrin

  • Hi Dobrin, 

    First at all thanks for your prompt reply. You perfectly got my point. I think the second solution is better in my case. To be honest  my main problem is that I will have low frequency signals (about 10Hz) and I need to display at least 2 periods of the signal, but at my sampling rate I can barely display half period. 

    What I've got so far is:

    AdcaResults[resultsIndex] = AdcaResultRegs.ADCRESULT0;
    AdcaResults1[resultsIndex] = AdcaResultRegs.ADCRESULT1;
    AdcaResults2[resultsIndex] = AdcaResultRegs.ADCRESULT2;

    resultsIndex++;

    if(RESULTS_BUFFER_SIZE <= resultsIndex)
    {
    resultsIndex = 0;
    }

    Buffer size=80;

    Actually I think your idea is brillant since I guess I can store the data somehow on the host computer based on some code on the javascript file in the GUI and keep displaying it until the next actualization.  If you can go ahead with the idea it would be great. I will try on my side too.

    Best regards,

    Danilo

  • Hi Danilo,

     

    I made a simple target program as well as GUI Composer application that show what I meant in the previous post.

    C64x_project.zip is the Code Composer project that has the target program.

    0385.c64x_project.zip

    The GUI Composer project is in test_buffer.zip.

    2656.test_buffer.zip

     

    The target program:

    -          The data is sampled continuously inside the arrays realdata.

    -          A new command from the GUI Composer application is received by detecting a change in the variable HostMessageId.

    -          When a new command is received the correct realdata is transferred to buffer.

    -          After all data is transferred hostMessageId will be updated with the one expected by the GUI Composer app.

    -          To simulate slow transfer and to prove that the scheme only displays whole arrays you can control the transfer rate by change the value passed to delay().

     

    The GUI Composer application:

    -          uses the GUI Composer “GUIVar” feature. The target variable is bound to property “buffer” in app.js instead of directly to the graph widget.

    -          Every time the value in the array buffer changes the function onBufferPropertyChanged  will be called.

    -          It will transfer the data to the graph only if the hostMessageId matches its latest request to the target.

    -          The first element will keep the graph series.

    -          Once the graph is updated a new request will be sent to the target by incrementing the variable HostMessageId.

     

    Let me know if you need more information to adapt this idea to your application.

    Regards

    Dobrin

  • Hi Dobrin,

    Thanks for your previous reply. I had to open the files with the notepad to see your code lines because I couldn't open them with my CCS-GUI installation (v5.5), but they were really helpful.

     Now I have another question and probably it was implicitly solved  in your files but it would be wonderful if you can give me further explanation.

     I want to be able to read/write variables in the target without binding them to widgets. I'm trying to do something more complicated but just to give you an example of what I'm trying to do

    Let's say I want to read the variable called  "Dc_volt" (uint16 type)  in the target and multiply by two and write the result in another variable called  "Dc_current" in the target as well.  What I'm doing so far is I  bound "Dc_volt" to one text widget  (value field) and "Dc_current" to another text widget and use the preprocessing function to call a function read_writex2 which looks more or less like:

    function read_writex2() {

    wc= dijit.byId("widget_161");
    z3=dijit.byId("widget_165").get("value");

    z4=z3x2;

    wc.set("value",z4);

    }

    So as far as I understand  the function read_writex2() is call from the widget and then executed. I was wondering if it is possible to do something like this but directly from the GUI without the bindings to widgets. I mean each refreshing time the GUI calls and executes read_writex2() and has access to the variables Dc_volt and Dc_current from the server rather than from the bind to the widgets. I know I can uncheck the visibility field on the widgets and have some "dummy" widgets just to read/write and execute functions but it doesn't seem to be efficient or at least a good coding practice. So hopefully you can help me about this with some advice/ explanation about how to do this or some references. Thanks in advance for your help.

    Best regards,

    Danilo

  • Hello Danilo.

    Do you want me to port the example to CCS 5.5? If it is clear to you by looking at the source code or if you planning to move to CCS 6.x I won’t do it, but if you need it – it’s not a big trouble to me to repost a CCS 5.5 version. Just let me know.

    Yes, you can bind a to a target variable without introducing a widget to you HTML/Javascript code. Just use the “GUI Vars” button at the left side of GUI Composer editor window – just below “Pallet” and “Outline” buttons. If you active that tab you see a “New GUI Variable” button at the top. Selecting it will let you add a new “GUI Variable”. Give it a name similar to the target variable. It will appear in the table of current GUI Vars. If you double click on the new item in the table it will let you edit its properties: “Server Bind Name” is the target variable you want to listen to; Type should be close to your target type variable. Two callbacks – onPropertyCahnge and onBindStatisCahnge. You are mostly interested in onPropoertyChange. Double click on the value cell of “OnPropoertCahnge” and a dialog will prompt you for a callback name. If you click Edit in that dialog a javascript editor will open to let you edit the function. Inside the new function some small commented code will give you an idea how to hook up the rest of the your code. Try it out and let me know if you have more questions.

    Regards

    Dobrin

  • Hi, I am working on something similar. Yes that would be great if you can post the CCS5.5 version.

    many thanks,
    konstantinos