Home AMX User Forum AMX General Discussion
Options

DEFINE_PROGRAM is not running, why?

which can prevent running the DEFINE_PROGRAM?
the message will not appear. the issue is not just about the message, anything that puts to run depending on the time is not done.
(***********************************************************)
(*            THE ACTUAL PROGRAM GOES BELOW                *)
(***********************************************************)
DEFINE_PROGRAM

WAIT 10
{
    IF (TIME = '18:00:00')
    {
       SEND_STRING 0,"'Show Message'"
    }
}
(***********************************************************)
(*                     END OF PROGRAM                      *)
(*        DO NOT PUT ANY CODE BELOW THIS COMMENT           *)
(***********************************************************)

Comments

  • Options
    DHawthorneDHawthorne Posts: 4,584
    Your asking for 1 second precision in a 1 second WAIT. WAITs are not intended for precision timing. You are parking the instruction in a queue, and when the time has expired the instruction is carried out. If there is any processing of any other sort going on, it isn't going to be at that second. Think of WAITs as "at least this long," not "exactly this long." If you want precision, use a timeline, and make the check for your exact time happen more than once a second.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    Your asking for 1 second precision in a 1 second WAIT. WAITs are not intended for precision timing. You are parking the instruction in a queue, and when the time has expired the instruction is carried out. If there is any processing of any other sort going on, it isn't going to be at that second. Think of WAITs as "at least this long," not "exactly this long." If you want precision, use a timeline, and make the check for your exact time happen more than once a second. It might even work if you set your WAIT to 5 instead of 10, or even just 1. At least then you have a chance of catching your exact to-the-second time. But even those methods are subject to processor lag. Instead, I would test for IF(LEFT_STRING(TIME,5) == "18:00"), and set a flag so it doesn't trigger multiple times.
  • Options
    Problem solved.

    Problem solved.
    the code works, the problem is with the clock of the controller.
    I noticed that the time displayed in the diagnostics is the time of the computer and not the master.

    English by google, sorry.
Sign In or Register to comment.