Start a new topic

RTC Value

Can i grouping the RTC???  So i could packages (e.g) [rtc0,rtc1,rtc2] to be a value. then save as one text..

how is the code?


- set main text empty
- convert rtc0 to a temporary text
- add temporary text to main text
- convert rtc1 to a temporary text
- add temporary text to main text
- convert rtc2 to a temporary text
- add temporary text to main text
- save main text


 

Thx Gerry, pardon me. Can you tell me step by step about teporary text please..

temporary text is just a temporary to use text, instead of the permanent to use main text ...

the step by step is already above ...

sorry, but the translation from this step by step into your code is something you must do ...

 

i used enhanced version. so what i mean is where i have to code about "temporary text" in text touch event? or in variable? how is the syntax. is it possible?


Or what you mean is accessing rtc var in MCU programming like using buffer etc? then send it again into the textbox?
i'm a newbie here..

not enhanced displays do not contain a RTC ... 


you code it wherever you like it to happen ...


a variable can't be propagated with code ... so ... you need a space where code insertion is allowed and make sense ...


For the right syntax, please refer to the Nextion commands. These commands can be found in the Nextion Instruction Set located here
http://wiki.iteadstudio.com/Nextion_Instruction_Set


It won't help you when I read the documentation, that's something you must do. Especially when you are a newby ...

For time, this code is an example


cov rtc3,tTime.txt,2

cov rtc4,vDay.txt,2

tTime.txt+=":"

tTime.txt+=vDay.txt


tTime is your destination, with a length of 5 (so it can hold "12:07").

vDay is a variable with a length of 2.


Similar code would work to produce a date of, for instance, "170211" (if that is what you are looking for).



1 person likes this

for the format "20170211"

sys0=rtc0*10000+rtc1*100+rtc2

cov sys0,t0.txt


or in the "170211 format Lance mentions

sys0=rtc0%100*100+rtc1*100+rtc2

cov sys0,t0.txt


1 person likes this

Thank's Lance, where i should put the code? in a blank text?

Thank's Patrick for let me know how to set the format ^_^
lot of thanks guys :D


my answer wasn't how to set a format

my answer was take rtc0 1 and 2 and put together into a text

For the date, you might put the code in the "Postinitialize Event" of the page. For the time (in minutes), you can set up a timer which expires every 60 seconds. In the timer event you then rebuild your output and reset the timer for another 60 seconds.


cov rtc3,va1.txt,2

cov rtc4,va2.txt,2

t5.txt=va1.txt+":"+va2.txt

tm0.tim=60000 // 1 minute


Login or Signup to post a comment