06-10-2013 11:39 PM
hi,
i want to read the count of the particular switch using niSwitch_GetRelayCount(); .i am not at all understanding arguments in that function could you send any sample codes to understand working of that function.
Thanks & Regards
12-16-2013 08:22 AM - edited 12-16-2013 08:25 AM
ViStatus niSwitch_GetRelayCount (ViSession vi, ViConstString relayName, ViInt32* relayCount);
Returns the number of times the relay has changed from closed to open. Relay count is useful for tracking relay lifetime and usage. Call niSwitch_WaitForDebounce before niSwitch_GetRelayCount to ensure an accurate count.
Refer to Relay Count to determine if the switch module supports relay counting.
Name | Type | Description |
---|---|---|
vi | ViSession | A particular NI-SWITCH session established with niSwitch_InitWithTopology, niSwitch_InitWithOptions, or niSwitch_init and used for all subsequent NI-SWITCH calls. |
relayName | ViConstString | Name of the relay. Refer to Devices for a list of valid relay names for the switch module. Examples of valid relay names: ch0, ab0, 1wire, hlselect |
relayCount | ViInt32 | The number of relay cycles. |
So you need to have the handle from opening (the ViSession), the knowledge of the relayName (you could call use the inherent IVI atrtributes:Driver Capabilities:Channel Count property and then loop on the GetChannelName and use that for every channel, and then finally you need a memory address to put the relay count in to (make a ViInt32 variable and use an & in front of the name).
Thanks
Sacha