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.
Tool/software: Code Composer Studio
Hello, I created a button widget in GUI Composer and linked the bindable trigger to a variable in my CCS code. Essentially, I want the microcontroller to calculate something and display the result in the GUI when I press the button widget once. However, the microcontroller does the above whenever I press the widget twice, not once.
So, my question is, does the bindable trigger increment by 1 everytime I press the widget? Also, is its initial value determined by the variable that is linked to the bindable trigger?
I'm very confused. I couldn't seem to find much documentation for GUI Composer. The best I could find is the following link: https://processors.wiki.ti.com/index.php/GUI_Composer_Widgets_And_Properties
Thank you for your time.
Please take a look at the GUI Composer documentation resources under this link. This is more relevant for the cloud based GC designer.
http://dev.ti.com/tirex/explore/node?node=AJvSrvufhzxVTyD9bKHSpw__FUz-xrs__LATEST
This similar forum thread might be helpful as well: https://e2e.ti.com/support/tools/ccs/f/81/t/778758
There are also several example GUIs available in the Gallery which can serve as a good reference and starting point for you to build upon:
https://dev.ti.com/gallery/
Hope this helps.
I looked at the forums you sent me, but I don't believe my problem requires JavaScript. I followed the suggestion on the bindable-trigger property of the button widget (i.e.: "trigger the action when BindableTrigger changes it to >0"). However, the problem is that one section of my code only executes on every other button press. Everything else executes except for a for loop. I even tried putting it into an if else statement, but that does not seem to work.
Am I missing something really obvious about GUI Composer? Do "samplesNumber" and "analyzingFreq" not update right away after I press "run correlation"?
Attached is a section of my code. The variables I am changing through the GUI are "samplesNumber" and "analyzingFreq". I want the code to run when I press "run correlation"
if (buttonCount > 0){ runXCorr = true; createAnalyzingWave(analyzingFreq, analyzingWave); uint8_t i; uint16_t sum = 0; if (true){ for(i = 1; i <= samplesNumber; i++){ createDataWave(dataWave); sum = crossCorrelationV4(dataWave, analyzingWave) + sum; } } averageValue = sum / samplesNumber; oldButton = newButton; buttonCount = 0; counter++; runXCorr = false; i = 1; }
Hello user,
When the button is pressed, the bindableTrigger will increment itself once. Where is samplesNumber and analyzingFreq defined?
What transport/model are you using?
Regards,
Patrick
I am defining samplesNumber and analyzingFreq as global variables, since I believe they need to be global variables to communicate with the GUI. The code that I presented on April 28th is inside a while(1){} loop, so it runs continuously.
I am using XDS as my transport method.
Thank you for your time.
XDS transport uses a (polling) program model. When the buttonTrigger changed, the value is sent to the device. All bindings will be updated on the next polling cycle.
I want to confirm if my understanding is correct:
Let's assume I enter a frequency and a number of samples. Then, when I press the run correlation button, the GUI sends the frequency and the number of samples for that particular polling cycle. However, if I update the 2 values after the next polling cycle, then when I press run correlation, nothing will happen.
Is that the correct way to think about it?
When you press the button, the GUI doesn't send frequency and number to the device. Pressing the button will change the bindableTrigger. If you bound the button's bindableTrigger to a device variable. Lets set myBindCounter, than myBindCounter will be incremented by one.
If you have bounded the frequency and sample text box's "value" button to your device's variable, than when ever you enter the value in the text box, GC will immediately sends the value to your device.
What I am referring to for polling is that the other values that you bounded to the device will not be updated until the next polling cycle. Lets say you change frequency by enter a value in the text box, sample will be updated if the value from the device is different than what is known by GC. Bounded values will be automatic updated both (two way databinding) ways if there a change detected.
From your sample code and screen shoot. I don't see how you bounded the sample and the frequency to the global variables. Without seeing your application, my guess is that most likely you didn't bound these two text box widgets' value property to your device's global variables and you didn't call gc.databind.registry.getBinding('my_model.mydevice_variable').getValue() to get the value for sample and frequency before using it in your JavaScript code.
I appreciate your help.
I misread your code as JavaScript code. In this case, you don't need to call the gc.databind.registry.getBinding(), this call is meant to be use for JavaScript.
Is there a way for you to print out the sampleNumber in your firmware code? So that when you changing the sample number text box with the GC app, you can verify whether the value is updated. Then pressing the button will increment the buttonCount and cause the if statement for the buttonCount condition to be true.
I assumed that you have some kind of timer to periodically loop through the if (buttonCount > 0) condition in your firmware code.
Patrick
Thank you for your help; again, I appreciate your time.
Your timer comment actually gave me an idea. I put a slight delay in my while loop, and it seemed to fix the problem.