User`s guide
86  Creating Freely Programmable Modules 
void CUFPTHVACController::Shutdown() 
{ 
 m_oTimer1.Stop(); 
 StopAllTimers(); 
} 
 See the 
Programmer’s Reference in Appendix A for more information on stopping timers. 
Writing an FPM Driver 
You can write an FPM driver using the i.LON SmartServer 2.0 Programming Tool. An FPM driver 
creates data points on the SmartServer and provides values for them by reading and writing to the RS-
232 and RS-485 ports on the SmartServer. To create an FPM driver, you specify the logic to be 
executed on the data points in the following four routines: Initialize(),Work(), Shutdown(), 
OnTimer(): 
•  The Initialize() routine is executed when the FPM driver is started or enabled. In the 
Initialize() routine, you start timers using the Start() method of the CFPM_Timer class 
or the START_TIMER() macro, open the RS-232 and RS-485 ports on the SmartServer, and 
write to the properties of the data points declared in the FPM driver. 
•  The Work() routine is executed when one or more data points declared in the FPM driver are 
updated. In the Work() routine, you write one or more IF-THEN(-ELSE) statements that 
evaluate whether the values of the data points in the FPM have been updated. If the data points 
have been updated, you initialize communication between your FPM and the RS-232 or RS-485 
serial interface and then write to the interface.  You can also read the properties of the data points 
declared in the FPM driver in this routine. 
•  The OnTimer() routine handles timer expiration events. In the OnTimer() routine, you 
initialize communication between your FPM and the RS-232 or RS-485 serial interface when a 
timer started in the Initialize() routine expires. You can then read and write to the RS-232 
or RS-485 interface, write updated values to the data point declared in the FPM driver, and read 
the properties of the data points. 
•  The Shutdown() routine is executed when the FPM driver is stopped or disabled as a result of a 
reboot. In the Shutdown() routine, you stop timers, close the RS-232 and RS-485 ports on the 
SmartServer, and perform any required cleanup. 
Note: The LonWorks\iLON\Development\eclipse\workspace.fpm directory on your computer 
includes a sample RS-232 driver that you can view, edit, compile, and deploy on your SmartServer. 
Writing the FPM Driver Initialize() Routine 
The Initialize() routine is executed when the FPM driver is started or enabled. You can use this 
routine to start timers; open the RS-232 or RS-485 serial interface on the SmartServer; and write to the 
properties of the data points declared in the FPM driver. 
•  You can start timers using the Start()method of the CFPM_Timer class and the 
START_TIMER() macro as described in Writing the FPM Application Initialize() Routine. 
•  You can open the RS-232 serial interface using the rs232_open() method. You can open the 
RS-485 serial interface using the rs485_open() method. 
•  You can set the default values, persistent flags, poll rates, and unit strings of the data points 
declared in the FPM driver using the following collection of data point properties. 
//write data point default value in raw hex 
Line1.SetDpProperty(FPM::Dp::cfgUCPTdefOutput, nValue); 
//set whether data point is persistent 










