Start a new topic

how can I write and read RTC value ?

hi all,

I work with basic-bascom but I have a problem to write and read the RTC value

I try a lot of different way without any success


can I do ?:

Print "rtc0,";
Print jyear;   'Jyear=2017


Print "rtc1,";
Print jmonth;

...

...

Do I send  Printbin &HFF ; &HFF ; &HFF   between all rtc0 to 5 ?

or can I send only one Printbin &HFF ; &HFF ; &HFF  at the end of transfer ?

------------------------

and how to read ?

must I use

print get rtc0 to receive the value in the nextion display ?


many thanks for your help

JP




Nextion Instruction Set: System Variables - rtc0-rtc6

rtc0 year

rtc1 month 1 to 12

rtc2 day 1 to 31

rtc3 hour 0 to 23

rtc4 min 0 to 59

rtc5 sec 0 to 59

rtc6 weekday 0 (Sun) to 6 (Sat) - autocalculated by RTC on valid date


To set the year variable from MCU side send

  rtc0=2017ÿÿÿ

To see year in Number variable n0 in Nextion Timer Event

   n0.val=rtc0


To send year variable to MCU within Nextion Event

    get rtc0

 Nextion will send 0x71 0xE1 0x07 0x00 0x00 0xFF 0xFF 0xFF


To have MCU request year variable returned to MCU

    get rtc0ÿÿÿ

Nextion will send 0x71 0xE1 0x07 0x00 0x00 0xFF 0xFF 0xFF

  0x71 - Nextion Return Code - Number follows

  0xE1 - Byte 0 of 32-bit 4 byte number in little endian order

  0x07 - Byte 1 of 32-bit 4 byte number in little endian order

  0x00 - Byte 2 of 32-bit 4 byte number in little endian order

  0x00 - Byte 3 of 32-bit 4 byte number in little endian order

  0xFF 0xFF 0xFF - data terminated (in this case number)

 

  So 0xE1*1+0x07*256+0x00*65536+0x00*16777216 = 2017


All commands over serial must end in 0xFF 0xFF 0xFF (or ÿÿÿ as text)



thanks Patrick
I try it and let you know
JP

 

Hi patrick,
Everything is ok now ! 
My error come from the notice  Nextion HMI: System Variables List  N°18 rtc4, min; and so on
you have a comma between rtc4 (or other) and the variable  
But your help was very important for the translation 0xE1*1+0x07*256+0x00*65536+0x00*16777216 = 2017

image


many thanks

JP

 

We have no direct access to the Nextion Instruction Set 

 - my OCD would have had it corrected long ago.


Please remember

  space 0x20 separates command from parameter

  comma 0x2C separates parameter from parameter.


Login or Signup to post a comment