beautypg.com

Adding a task, Making a submenu selection, Adding a mode – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 47

background image

46

CHAPTER 4 • OPERATING FUNCTIONS AND MENU

Adding a Mode

ClickMenuAddMode is used to attach an existing mode to the menu. In the example below,

Setup1 and Mode1 are the two functions that make up the operating mode. Mode1 will be

the first parameter in ClickMenuAddMode and Setup1 will be the second parameter. The

third parameter, BLUE, designates the LED to turn on in the menu selection process.

In this example, selecting BLUE from the menu will run Setup1 and then run Mode1 con-

tinuously. The remaining two parameters, 3 and 2, represent the number of options avail-

able in the first and second submenus.

ClickMenuAddMode(Mode1, Setup1, BLUE, 3, 2);

Adding a Task

ClickMenuAddTask is used to attach an existing task to the menu. In the example below,

Task A is the function that makes up the task and will be the first parameter in ClickMenu-

AddTask. The second parameter, YELLOW, is the LED that designates Task A within the

menu selection process. Selecting YELLOW in the menu will run Task A and then return to

the previous operating mode. The remaining two parameters, 4 and 0, represent the num-

ber of options available in the first and second sub menus.

ClickMenuAddMode(TaskA, YELLOW, 4, 0);

The Modes and Task in Example Code 4.1 are attached to the menu inside of the main func-

tion. Once the menu is completely constructed, call the function ClickMenuStart to start

running the first mode.

void main( void )
{
ClickMenuAddMode(Mode1, Setup1, BLUE, 3, 2);
ClickMenuAddTask(TaskA, YELLOW, 4, 0);
ClickMenuStart();
}

Making a Submenu Selection

The previous examples used four or fewer submenu options, but up to eight options are

possible. The following tables show how to identify which of the eight possible options is

selected. Hold the button down until the desired submenu indicator is displayed (see Tables

4.1 and 4.2).