Start a new topic
Not Taken

How to know the name of the current page using the Arduino?

Good evening everyone.


I am running the update a Page. Page that is displayed in real-time temperature of a sensor. The data is sent every time the serial port. But as I need to send data Nextion to the Arduino, I need to stop sending data, and returns are sending after completion.

If I knew how to identify the name of the page via Arduino, I could run a logic that would able to print the shipping of temperature values only when the temperature Page was active.

Someone would know how to identify which current screen Nextion is?


I thank everyone.


post your arduino code and hmi file. i try to debug it thanks
Would not it help to send the "sendme" command to the Nextion to get back the page number? Then you could do a switch() statement on the Arduino with the page-related things in the proper case clause. The sendme response has the page number in the second byte.

This has been covered in this thread already: http://support.iteadstudio.com/support/discussions/topics/1000062463

 

Good evening everyone.


Sorry take to answer the comments. I am an Electrical Engineer, and I'm a little out of time due to work.

After calmly analyze my problem, I do not I heed before purchasing HMI NEXTION, greater attention to the question transmission medium.

As the HMI NEXTION communicates via serial protocol (TTL). I do not I heed that it transmits only HALF-DUPLEX, not in FULL-DUPLEX.

In the project I'm developing, the need for visualization and transmission of simultaneous data. In my case is viewing the readings of thermocouples and temperature parameters configuration via HMI.


So thank the contribution of all.


I will check other possible solutions, with ATmega and HMI NEXTION. If not actually found the solution, I will use a PLC it.

If there is any configuration, or update, so that the HMI NEXTION, perform transmission FULL-DUPLEX, please inform me if possible.


Thank you for attention.


Messias da Silva

Electrical engineer


Messias da Silva


My apologies, I have indeed misunderstood.  Best answers about the Nextion HMI can be obtained by opening a support ticket which are directed to the company employees, and not to the user forums.


It is my understanding that the TX and RX lines connect to the onboard Nextion MCU to its USART lines, that this then is indeed a FULL-DUPLEX device and not a TTL device.  To ensure that the model of Nextion HMI Display you are interested in are indeed USART FULL-DUPLEX and not TTL, again please open a support ticket that is directed to the ITEAD Studio employees and not to the user group.


It is also my understanding the ITEAD Studios also has services to create custom PCBs for quantities 5 or more, you may like to speak to them about this option, it may ensure that any additional features and components you require are directly included with your HMI Displays.


As to your question as to "which page" is defined in the Nextion Instruction Set.


The page number can be externally retrieved by issuing the "sendme" command to the Nextion Display
A 5-byte response is expected to return: 0x66 0x03 0xFF 0xFF 0xFF.
0x66 - command successful

0x03 - current page displayed by HMI is page 3

0xFF 0xFF 0xFF - the three byte delimiter signifying the end of data.


To simplify this matter, the page number can also be internally generated. The Nextion HMI Editor has preinitialization and postinitialization events for each page and actually most components.  One could simply trigger the 5-byte response by adding the "sendme" command in the postinitialization event for the desired pages.  Each and every time the HMI users select a "sendme enabled" page, the Nextion display will automatically send the 5-byte response once it sequentially processes the sendme command during the HMI postinitialization phase.



Sincerely


Patrick


1 person likes this

Good evening everyone.


Patrick, quiet without problems. I did not realize the comment questioning the HMI NEXTION. Unfortunately HMI NEXTION does not perform transmission FULL-DUPLEX. Ie, shipping, and simultaneously receiving data between HMI and ATMega via Serial.

I have developed a solution to my problem. I will make the pages of the selection process controlled via digital port.

The ITEAD is to be congratulated because the HMI NEXTION is simple and intuitive.

But a great improvement, which would facilitate the rapid acceptance of the same in the industrial sector. It would be the Ethernet protocol implementation.


As soon as possible post of pages selection logic. For understanding.


Thank you for attention.


Messias da Silva



1 person likes this

Messias da Silva


Again please forgive past misunderstanding.  Ethernet is a great idea.


Possibly the internal buffers for incoming / outgoing serial data are too limited to achieve FULL-DUPLEX behaviour.  Programming is generally sequential instructions, and the priority of interrupts becomes key.

If Rx interrupt is priority 2 and Tx interrupt is priority 3 - Rx will dominant to the point Tx may not realize its turn before the buffers are filled and data loss has occurred.  This issue is part of serial communications.


We don't have any control to adjust the buffer size inside the Nextion mcu, so it becomes very important when we attach the connecting mcu that it will account for ensuring a sufficient buffer to receive from the Nextion, and to limit in smaller portions the amount of data being sent to the Nextion mcu.  We also do not have hardware control lines like ClearToSend - CTS and ReadyToReceive - RTR, so the responsibility of the software to manage the in/out data becomes greater.  Likewise similar issues will exist with Ethernet  or Wifi.  When you develop for the second MCU that will connect to the Nextion, it could be a possibility to include Ethernet in that circuit, and then program to send/receive from Ethernet, process those request/responses, and also manage send/receive from the Nextion.


1 person likes this

Correction to the above,

ReadyToReceive - RTR should have been RequestToSend - RTS.

I am now reviewing all of the Feature Requests, this will take some time, patience please.

This is not a feature request

The answer to the question, best to retrieve page by numbers

SendCommand("get dp")  // will return page number using Nextion numeric return codes

Login or Signup to post a comment