Q-Code User Manual
Ver. 7.0 2021/11/30
143
4.2.45 Switch(Xi) = [Path0, Path1, Path2,..Path255]
Similar to the 4-bit Switch(Ri), this switch command will switch from current path to corresponding path
according to the value of Xi. This path can be a foreground path, a background path, or the “X”
(indicating no action). Jump to Path0 if the content of Xi is 0, and jump to Path1 if it is 1, and so on.
Ex.
X0=3, Switch(X0)=[Path1, Path2, X, Path3], Path4
; X0=3 so jump to Path3.
Ex.
X0=4, Switch(X0)=[Path1, Path2, X, Path3], Path4
; X0=4 exceeds the range defined by
switch, so switch command is
skipped. The next command will be
executed.
4.2.46 Switch(Random) = [Path0, Path1, Path2,… Path255]
Switch command will switch from current path to corresponding path according to the value of Random.
This path can be a foreground path, a background path, or the ”X” (indicating no action).
Ex.
Random=3, Switch(Random)=[Path1, Path2, X, Path3], Path4
; Random=3, so jump th Path3.
Ex.
Random=4, Switch(Random)=[Path1, Path2, X, Path3], Path4
; Random=4, exceeds the
range defined by Switch, so
switch command is skipped.
The next command will be
executed.
4.2.47 Switch(Px[d x d x]) = [Path0, Path1, Path2,... Path15]
User can use this command for reading designated IO Pin of Port and combine the IO status as a
value, then jump to the corresponding path based on the value. Switch command will switch from
current path to corresponding path according to the value of d. This path can be a foreground path, a
background path, or “x” (indicating no action). This is aimed for achieving the function of bonding
option.
Ex.
Read PB.1 and PB.3, the two bits can have 4 combinations.
TR1: Switch( PB[d x d x] ) = [P0, P1, P2, P3]
; Using PB.1 and PB.3 to combine 4 outcomes.
P0: PlayV(Ch0, $V0)
; When PB.1 and PB.3 are 0, execute P0 path.
P1: PlayV(Ch0, $V2)
; When PB.1 is 1 and PB.3 is 0, execute P1 path.
P2: PlayV(Ch0, $V8)
; When PB.1 is 0 and PB.3 is 1, execute P2 path.
P3: PlayV(Ch0, $V10)
; When PB.1 and PB.3 are 1, execute P3 path.