Step 9: implementing the wheel input – Echelon NodeBuilder FX/PL Examples User Manual

Page 38

Advertising
background image

30

Using the NodeBuilder FX/PL Example


//<Input NV Define>
#ifdef _HAS_INP_NV_6
//
//<Fblock NV When>
when(nv_update_occurs(nviTimeSet)) {
if (fblockNormalNotLockedOut( fblock_index_map[nv_in_index]) )
{
updateDeviceState(nv_in_index,

nv_array_index,

fblock_index_map[nv_in_index]);

// TODO: process nviTimeSet event here

}
}

when(nv_update_occurs(nviAlarmAck))
//
//--}}NodeBuilder Code Wizard End
// disabled the above to prevent CodeWizard from re-generating
// associated code
{

if

(fblockNormalNotLockedOut(fblock_index_map[nv_in_index]) ) {

updateDeviceState(nv_in_index, nv_array_index,
fblock_index_map[nv_in_index]);

// TODO: process nviAlarmAck event here

}
}

19. Still in RealTimeKeeper.nc, add the following code in bold to the FBC_WHEN_RESET else-if

clause in the realtimekeeperdirector() function:

else if ((TFblock_command)iCommand == FBC_WHEN_RESET)

rtc_coretick = nvoTimeDate::cpRtcUpdRate * 100UL;

if (rtc_alarmstate == rtc_alarm_alarm) {

RealTimeKeeper::nviAlarmState.state

=

SWITCH_ON;

}

setLockedOutBit(uFblockIndex, FALSE);

20. Build the development target. To do this, right click the Development target, and then click Build

on the shortcut menu. The LonMaker tool automatically loads the new application into the device
hardware.

21. Add the new functional block and network variables to the LonMaker drawing and use the

LonMaker tool and LonMaker Browser to verify correct operation.

Step 9: Implementing the Wheel Input

You can complete the device application by implementing an open loop sensor where the principal
network variable reports the status of the quadrature hardware input. In this step, you will use a more
comprehensive implementation of a functional profile by supporting more of the functional profile’s
optional features. To perform this step, follow these steps:

1. Click the NodeBuilder tool Taskbar button in the Taskbar to return to the NodeBuilder tool.

Right-click the device template and select Code Wizard from the shortcut menu. The Code
Wizard opens.

2. Right-click the device template’s Functional Blocks folder and select Add Functional Block

from the shortcut menu. The Add Functional Block dialog appears.

3. Add a single SFPTopenLoopSensor functional block. Name the new functional block Wheel.

Click OK.

4. When prompted, indicate that you do not want to create the new functional block as part of an

array.

Advertising