Start a new topic

My Clock Stop...

In a moment, i write the instruction "rtc3=rtc3+1" on a button for edit the hour but the clock stop, i deleted the instruction and it doesn't move.


HELP!!

HMI
(4.7 MB)

So what happened?

You maybe possibly set your RTC hour to 24, 25, 26 etc out of range value.

  MCUs trust their programmers to program instructions that wont hurt them.


Your Timer code ...

    does your code have what to do if value out of range?

    aahhhh ... most likely not.   let's see.

    hours 0 to 9 and 13 to 21

... so twice a day you have no code to display 10,11,12th hours?

If there is no code for what to display when the hour is such

 ... it will not change (no code to change) and it seems to you to be stopped


Why did you opt for a Text Field for t6,t7,t8?

Number fields with .lenth attribute set to 2 would provide leading 0


Make a string variable va0.txt = "ENEFEBMARABRMAYJUNJULAGOSEPOCTNOVDIC"

then if

  hr is n0, min is n1 and sec is n2 day is n3

this timer could be super shortened in comparison to

   n5.val=rtc0

   n3.val=rtc2

   n0.val=rtc3%12

   n1.val=rtc4

   n2.val=rtc5

   sys0=rtc3/12

   if(sys0==1)

   {

      t5.txt="p.m."

   }else

   {

      t5.txt="a.m."

   }

  sys0=rtc1-1*3

  substr va0.txt,t4.txt,sys0,3



1 person likes this

Thank's man, i'm doing what you told me.

Login or Signup to post a comment