LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

getting relay count

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

 

0 Kudos
Message 1 of 2
(3,437 Views)

niSwitch_GetRelayCount

Specific Function

C Function Prototype

ViStatus niSwitch_GetRelayCount (ViSession vi, ViConstString relayName, ViInt32* relayCount);

Purpose

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.

Parameters

NameTypeDescription
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

// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 2 of 2
(3,307 Views)