Q-Code User Manual
Ver. 7.0 2021/11/30
237
4.21.4 INT = n
Set the interval between interrupts. n = 0.256 ms/ 0.512 ms/ 1.024 ms.
Note: NY4 / NY6 / NY7 / NY9T / NX1 do not support this command.
Ex.
[Path]
PowerOn
: KEY1, INT_ON, INT=1.024
Interrupt: !PA, INT_RET
; Invert the output value of PA every 1ms
; (each time interrupt occurred).
4.22 Delay Command
Delay Command
-
-
-
4.22.1 Delay(Time)
This command is for providing delay in
Q-Code
for foreground and backgrounds, respectively.
Time:
unit: sec or ms (default is sec), with minimum value of 4ms and maximum value of 15 sec. Less
than 4ms, will be rounded up.
Note:
1. Due to deviation between RTC_1024Hz and 1ms (0.9765625ms - 1ms) / 1ms
≒
-2.34%,
there is -2.34% delay time deviation in Q-Code 6.51 or older versions. This deviation will be
compensated in Q-Code 6.60 or newer version.
2. NX1 counter is using RTC, which contains ±1.5% deviation.
3. NX1 is using Time-Sharing Mutli-Process Architecture. Deviations described in Note 1,
Note 2 do not include time of context switching.
Ex.
Delay 0.1sec.
[Path]
PowerOn
: Delay(0.1)
; Delay 0.1 second.
or
PowerOn
: Delay(100ms)
; Delay 100ms.
4.22.2 Delay(Ri:Rj:Rk)
According to the value of RAM to set delay duration. Ri=High bit, Rj=Middle bit, Rk=Low bit.
Ex.
Calculate Ri, Rj, Rk to delay 1 second.
1000 ms / 4.096 ms = 244.1 (244.1 is rounded up to 245), express 245 to hexadecimal 0xF5. (4.096ms
is the minimum unit of counter)