beautypg.com

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

Page 122

background image

CHAPTER 11 • CLICK SUPERVISOR SUPPORT 121

// Turn ON digital output 1
ClickDioSet(D1,1);
outputDuration =
(ClickSupervisorOemConfig0.outputDurationMSB << 8)
+ ClickSupervisorOemConfig0.outputDurationLSB;
OutputDurationEndTime = MS_TIMER + outputDuration;
ClickLedOn(RED1);
if (ClickSupervisorOemConfig0.enableAlerts == SET1)
{
ClickSerialPortTransmit(V2,32,
ClickSupervisorOemConfig0.AlertMessage);
ClickSerialPortTransmit(V2,2,”\r\n”);
}
break;

case STATE_ACTIVE_TIMING:
// non-blocking delay timer
if ((long)MS_TIMER - OutputDurationEndTime >= 0)
{
// Turn OFF digital output 1
ClickDioSet(D1,0);
ClickLedOff(RED1);
OutputState = STATE_INACTIVE;
}
break;

case STATE_INACTIVE:
if (ClickBtnPressed())
{
GenerateVirtualVehicleSpeed();
GenerateEventMessage();
if (
(VirtualSpeed >
(float)ClickSupervisorOemConfig0.overSpeedMPH)
&&(VirtualSpeed <
(float)ClickSupervisorOemConfig0.underSpeedMPH)
)
{
OutputState = STATE_ACTIVE_RESTART;
}
else
{