Hi all, how are you?. I have several crop objects in my screen (an NX4024T032) and I want to update its visibility as soon as a global variable gets updated (I don’t know if I can do it with a local one) and I have the code as follows on the post initialize event of the page
while(1==1)
{
lumin=lumin&262143 // This line just eliminates all bits over the bit 18 of the variable lumin
fr1=lumin&131072 // This line only lets the bit 18 of the variable active.
fr1=fr1>>17 // Rotates the bit 18 exactly 17 times to the left.
vis f1r,fr1 // The visibility of the crop depends on the state of the previous bit
}
in the .s file of the project I’ve declared both variables like follows
int lumin=0
int fr1=0
and the crop is f1r, but as soon as the page is initialized the screen simply freezes -I suppose tha is for the endless while but I don’t know what to do- and I have to abort the project to get out of the page.
I need the crop updated only when the variable is updated over serial so how can I do that?.
Store the value of the global variable in another variable. If they are not equal change the crop and set the older variable equal to the new. No need for a while loop.
Thanks @elf for the suggest of eliminate the if, about the variable update right now I’m doing it this way: from the miccrocontroller is sent the value for that variable and the state of the screen is updated thorugh a hotspot bay doing click over serial, I mean, we are sending the command click over serial to the HMI to show the new state on the HMI
The code on the Nextion responding to the click command should just check the state of the two global variables (You need to add the stored state variable). If they are different then update the display, otherwise ignore the click command.
Well, what I’m trying to explan is that I’m sending first the variable to the HMI and after that I send a click command to force the HMI to update the state on the screen. I’m doing it that way because it is a timed event (every second) but the time count is made on the main microcontroller
exactly, thats is the way that I’m using, the data and the trigger are sent every one second, then the HMI once is triggered updates the onscreen info.
Thanks for your reply but for that time I was understanding bad what I needed to do. Rearranging I solved the problem.
This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).