omron — Programming Example: Pendant Menu

Programming Example: Pendant Menu ; Display Custom Message PDNT.WRITE $p.title, $p.msg[], $p.f[1], $p.f[2], $p.f[3], $p.f[4] WHILE TRUE DO KEYMODE 1, 4 = 0 ;Set Keymode of F keys detect next keypress key = PENDANT(0) ;Obtain Pressed key CASE key OF VALUE 1: ;Apps pressed, continue to Screen 2 GOTO 10 VALUE 2:

;Display Filler Notification ; This will be cleared on Pendant by pressing OK or Cancel PDNT.NOTIFY "Status", "No Program Running" ;Obtain info of task 1 here END END ; Setup Screen 2 10 $p.title = "List of Applications" $p.f[1] = "Run" $p.f[2] = "Up" $p.f[3] = "Down" $p.f[4] = "Done" FOR i = 0 TO 10 $p.msg[i] = "" END FOR i = 0 TO prog.len-1 IF i == app.sel THEN ; Underline the currently selected Application $p.msg[i] = $p.msg[i]+" "+$prog.list[i]+" " ELSE $p.msg[i] = $p.msg[i]+" "+$prog.list[i]+" " END END ; Display Screen 2 - List of Applications PDNT.WRITE (prog.len) $p.title, $p.msg[], $p.f[1], $p.f[2], $p.f[3], $p.f[4] KEYMODE 1, 28 = 0 WHILE TRUE DO key = PENDANT(0) CASE key OF VALUE 1, 18:

;F1 or OK CALLS $prog.list[app.sel]() GOTO 10 ; VALUE 2, 17: ;F2 or Up arrow app.sel = (app.sel-1) MOD prog.len GOTO 10 VALUE 3, 21: ;F3 or Down arrow app.sel = (app.sel+1) MOD prog.len eV+Language User's Guide, v2.x, 18318-000 Rev A Page 185