beautypg.com

Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 121

background image

120

CHAPTER 11 • CLICK SUPERVISOR SUPPORT

///////////////////////////////////////////////////////////////
// ExampleCode11.1.c
///////////////////////////////////////////////////////////////

#use click500core.lib
#use click500message.lib
#use click500supervisor.lib
#use click599config.lib

#define STATE_INACTIVE 0
#define STATE_ACTIVE_RESTART 1
#define STATE_ACTIVE_TIMING 2
#define BAUD_RATE_BPS 9600

// Function Prototypes
void MainMode(void);
void SetupMainMode(void);
void GenerateVirtualVehicleSpeed();
void GenerateEventMessage();

// Global vars
int OutputState;
float VirtualSpeed;
long OutputDurationEndTime;

void main(void)
{
ClickMenuAddMode(MainMode, SetupMainMode, BLUE, 0, 0);
ClickMenuStart();
}

void MainMode(void)
{
unsigned int outputDuration;
unsigned i;
int ret;
unsigned value;

switch (OutputState)
{
case STATE_ACTIVE_RESTART:
OutputState = STATE_ACTIVE_TIMING;