Sets count match event.
Ret = SmcWCountEvent( Id , AxisNo , hWnd , EventMode , CountType, Count )
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
SSpecify the Deice ID retrieved by SmcWInit
function.
AxisNo
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify axis number.
hWnd
[ VB.NET: IntPtr ] [ C, C++: HWND ] [ C#: IntPtr ] [ Python: ctypes.wintypes.HANDLE
]
Specify the window handle who activates the event.
EventMode
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Set the event to valid/invalid.
0 |
Invalidate the event. |
1 |
Validate the event |
CountType
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Set the counter that does the count agreement.
0 |
Number of output pulses |
1 |
Number of encoders of count pulses |
Count
[ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long
]
Set the number of counts.
The specified range varies depending on the device.
For details, please refer to "Specifications based on devices section".
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
0 |
Terminated normally |
Non-zero |
Terminated abnormally |
See also: Error code details
When the counter value reaches the number
of specified counts, the events occur.
If the event generation function is executed once, the event is generated
every time the factor is generated afterwards.
It is not necessary to execute it two or more times excluding the purpose
to stop the event.
The message number is fixation.
The message of message number "8701H" is done in the specified window handle when the output pulse number count agreement event is generated and PostMessage is done.
The message of message number "8702H" is done in the specified window handle when the encoder pulse number count agreement event is generated and PostMessage is done.
The following information enters wParam and
lParam that is the parameter of the message respectively.
LOWORD(wParam)=ID acquired in SmcWInit function.
LOWORD(lParam)=Axis number.
- HIWORD and LOWORD show high word and low word respectively.
In the SmcWSetCtrlTypeOut
function, the count agreement can output the signal while the condition
is consisting only as for the output signal that the counter count agreement
signal setting is done.
- Therefore, the change in the level is at a very fast pulse output and
there is a possibility not to be able to recognize as data in the output
destination for the moment.
- The signal become like the state that the level changes when stopping
by the number of specified pulses.
- One shot pulse that specifies the width of the signal cannot be output.
There are two kinds of signals as follows.
- Output pulse counter count agreement signal(CP1)
Set "0: the number of output pulses" to CountType
and when the output pulse number count agreement event is effective.
- Encoder counter count agreement signal(CP2)
Set "1: the number of encoders of count pulses" to
CountType and when the encoder pulse number count agreement event is effective.
Model No. |
LSI chip for Pulse Control chip |
The valid range for Count |
SMC-4DL-PE |
PCL6145 (32bits) |
-2,147,483,648 to +2,147,483,647 |
PCL6143 (28bits) |
-134,217,728 to +134,217,727 |
|
SMC-4DF2-PCI |
PCL6045BL equivalent (28bits) |
-134,217,728 to +134,217,727 |
You can confirm "LSI chip" on your device with "Diagnostic Report".
The count agreement event when becoming number 500 of output pulses for axis number 1 is set.
VB.NET
Dim Ret As Integer
Ret = SmcWCountEvent( Id , 1 , Handle , 1 , 0 , 500 )
C, C++
long Ret;
Ret = SmcWCountEvent( Id , 1 , hWnd , 1 , 0 , 500 );
C#
int Ret;
Ret = Smc.WCountEvent( Id , 1 , hWnd , 1 , 0 , 500 );
Python
Ret = ctypes.c_long()
Ret.value = csmc.SmcWCountEvent( Id , 1 , hWnd , 1 , 0 , 500 )
See Also