Echelon i.LON SmartServer User's Guide Page 91

  • Download
  • Add to my manuals
  • Print
  • Page
    / 266
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 90
i.LON SmartServer 2.0 Programming Tools User’s Guide 77
//set initial data point values
nviSetPoint = 0;
nviTemp = 0;
nciHystereis = -17.77778;
//start timers
m_oTimer1.Start(FPM_TF_REPEAT, 2000);
m_oTimer2.Start(FPM_TF_ONETIME, 3000);
START_TIMER(m_oTimer3, FPM_TF_REPEAT, 2000, OnMyTimer3);
// to do: create OnMyTimer3()routine to handle m_oTimer3
}
Note: Initialized input data point values are not propagated to output data points when the
Initialize() routine executes. Input data point values are only propagated to output data points
when the Work() routine executes as a result of an input data point value changing.
Declaring and Initializing Timers
To use a timer in your FPM application, you must first declare it as a member of the CFPM_Timer
application class in the header file (.h extension) of your FPM application and then initialize it in the
source file (.cpp extension). To declare and initialize a timer, follow these steps:
1. Open the header file. To do this, either double-click the header file (.h extension) in the C/C++
Projects view or right-click it and then click Open on the shortcut menu. The header file view
opens to the right of the source file view.
2. Scroll to the “Mandatory Application Members” section in the header file, and then declare the
timer using the following syntax:
CFPM_Timer m_oTimer1; //declare a timer
CFPM_Timer m_oTimer2; //declare a timer
CFPM_Timer m_oTimer3; //declare a timer
3. Click the tab for your source file (.cpp extension), scroll to the “Constructor/Deconstructor”
section, and then initialize the timer using the following syntax:
, m_oTimer1(this) //initialize timer
, m_oTimer2(this) //initialize timer
, m_oTimer3(this) //initialize timer
Starting Timers
You can start timers using the standard Start() method of the CFPM_Timer class or the user-
defined START_TIMER() macro. Note that when you start timers, you should set the timer interval
to a minimum of 100ms.
Using the Start() Method
The Start() method of the CFPM_Timer class is the standard approach for starting timers. It
causes the FPM application to call the OnTimer()routine, which handles the timer expiration event.
The Start() method has the following syntax:
void Start(FPM_TimerFlags_t eMode, uint_t nTimeoutMillis);
The eMode parameter specifies the type of the timer. You can enter FPM_TF_REPEAT for a
repeating timer, or you can enter FPM_TF_ONETIME for a timer that is used just once.
The nTimeoutMillis parameter specifies the timer interval in milliseconds. You should set
this parameter to a minimum of 100ms.
Page view 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 265 266

Comments to this Manuals

No comments