HOME > RT-C Language
Controller > Sample "Servo Motor Control"
Issue Event Process
|
|
Create module whch is always running while the program is running, and write call process to
call "event issue API" in __Process()
|
|
Process by EVENT task
|
|
Create module which is assigned to EVENT task and write arbitrary process.
Assign it to arbitrary event to use. ※ Please refer to "Add Task" in the users manual on how to add / assign EVENT task. |
|
/// <summary>
/// *****************************************************************************************************
/// Main Process Block
/// *****************************************************************************************************
/// </summary>
[FUNCTION_BLOCK]
public class _main
{
// *** Internal Variables ***
public static UInt32 ScanCount; // Count Scan times
/// <summary>
/// Program - Process in download
/// </summary>
public _main()
{
}
/// <summary>
/// Program - Process in reset
/// </summary>
~_main()
{
}
/// <summary>
/// Program - Process in start
/// </summary>
public void __Init()
{
ScanCount = 0;
}
/// <summary>
/// Program - Process in execute
/// </summary>
public void __Process()
{
ScanCount++; // Count Scan times
if ((ScanCount % 100) == 0)
{
Eclr.Pcos.Resource.RaiseTaskEvent(2); // Issue event [No.2] per 100 scans
}
}
}
/// <summary>
/// *****************************************************************************************************
/// Event Process Block
/// *****************************************************************************************************
/// </summary>
[FUNCTION_BLOCK]
public class _event
{
// *** Internal Variables ***
public static UInt32 ExeCount; // Count Scan times
/// <summary>
/// Program - Process in download
/// </summary>
public _event()
{
}
/// <summary>
/// Program - Process in reset
/// </summary>
~_event()
{
}
/// <summary>
/// Program - Process in start
/// </summary>
public void __Init()
{
ExeCount = 0;
}
/// <summary>
/// Program - Process in execute
/// </summary>
public void __Process()
{
ExeCount++; // Add oeration times
}
}