Echelon i.LON SmartServer User's Guide Page 235

  • Download
  • Add to my manuals
  • Print
  • Page
    / 266
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 234
i.LON SmartServer 2.0 Programming Tools User’s Guide 221
The pbyValue parameter specifies the value to be written to the data point.
The STATUS value returned by this method can either be ERROR or OK.
EXAMPLE
The following example demonstrates a Write()method that changes the value of a data point
returned by a List() method.
FPM::FpmItemColl_t items;
SNVT_time_stamp time;
Write(items[0], (Byte*)&time);
Timer Methods
You can use timers to perform tasks that must be performed periodically, such as reading data from the
RS-232 or RS-485 interfaces or performing data point updates. A separate CFPM_Timer application
class handles the starting, stopping, and querying of timers.
To use a timer in your FPM, you must first declare it as a member of the CFPM_Timer application
class in the “Mandatory Application Members” section in the .h file using the following syntax:
CFPM_Timer m_oTimer1; //declare a timer
You then need to initialize the timer in the “Constructor/Deconstructor” section of the .cpp file using
the following syntax:
, m_oTimer1(this) //initialize timer
Start()
You can use the Start()method of the CFPM_Timer class to start a timer. The Start()method
causes the system to call back the OnTimer()routine, which handles the timer event. The
Start()method is the standard approach for starting timers. You can use this method in the
Initialize(), Work(), and OnTimer()routines of an FPM application, and you can use it in
the Initialize()routine of an FPM driver.
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.
EXAMPLE
The following example demonstrates a Start()method that starts a timer and repeats it every 2
seconds.
CFPM_Timer m_oTimer1; // declared in header file
, m_oTimer1(this) // initialized in source file
...
m_oTimer1.Start(FPM_TF_REPEAT, 2000);
START_TIMER()
You can use the START_TIMER()macro as an alternative approach for starting timers. It causes the
system to call back a user-defined timer handler method. You can use the START_TIMER()macro
Page view 234
1 2 ... 230 231 232 233 234 235 236 237 238 239 240 ... 265 266

Comments to this Manuals

No comments