Digital I/O Control Reference 15.0
Methods

Functions

__int3264 BitListenerCreate (long Port, State Value, long Delay)
 Creates a BitListener object and initiate monitoring of an individual input port. More...
 
boolean BitListenerDestroy (__int3264 BitListener)
 Destroys a BitListener which was created with the BitListenerCreate method. More...
 
boolean BitListenerStart (__int3264 BitListener)
 Starts a BitListener which was created with the BitListenerCreate method. More...
 
boolean BitListenerStop (__int3264 BitListener)
 Stops a BitListener created with the BitListenerCreate method. More...
 
__int3264 BitTogglerCreate (long Port, long Delay)
 Creates a BitToggler object and invert the state of an output port for a specific period of time. More...
 
boolean BitTogglerDestroy (__int3264 BitToggler)
 Destroys a BitToggler which was created with the BitTogglerCreate method. More...
 
boolean BitTogglerStart (__int3264 BitToggler)
 Starts a BitToggler which was created with the BitTogglerCreate method. More...
 
__int3264 DWORDListenerCreate (long Port, long Value, long Delay)
 Creates a DWORDListener object and initiate monitoring of an individual input group port. More...
 
boolean DWORDListenerDestroy (__int3264 DWORDListener)
 Destroys a DWORDListener which was created with the DWORDListenerCreate method. More...
 
boolean DWORDListenerStart (__int3264 DWORDListener)
 Starts a DWORDListener which was created with the DWORDListenerCreate method. More...
 
boolean DWORDListenerStop (__int3264 DWORDListener)
 Stops a DWORDListener created with the BitListenerCreate method. More...
 
State GetInBit (long Port)
 Return the state of an input port. More...
 
long GetInDWORD (long PortGroup)
 Return the state of an input port group. More...
 
State GetOutBit (long Port)
 Return the state of an output port. More...
 
long GetOutDWORD (long PortGroup)
 Return the state of an output port group. More...
 
State SetOutBit (long Port, State Value)
 Sets the state of an output port. More...
 
long SetOutDWORD (long PortGroup, long Value, long Mask)
 Sets the state of an output port group. More...
 

Detailed Description

Function Documentation

◆ BitListenerCreate()

__int3264 BitListenerCreate ( long  Port,
State  Value,
long  Delay 
)

Creates a BitListener object and initiate monitoring of an individual input port.

The method creates a thread in which the port is monitored. This thread is not strarted until the BitListenerStart method is called. The port is then interrogated continously. To prevent that the system dedicating too much processor time to the Listener the thread passes control to the system for 'Delay' milliseconds. If the thread detects the required state of the port it triggers the Listener event. Then the user can respond to this event.

Attention
The thread should be stopped with the BitListenerStop, otherwise the port remains in its state then and the BitListener event continue to be fired.
A BitListener object is destroyed with BitListenerDestroy method.
Important Information on Delay parameter:
Internally, the thread uses the operating system sleep function. A value of 0 is allowed altough it means that other threads receive verly little CPU time and the system workload totals nearly 100%.
Therefore it is best to choose a value greater than 0. When the system workload is low, a value of 1 was found to be optimal.
Parameters
[in]PortPort to be monitored. The value ranges between 0 to NumInputs - 1.
[in]ValueRequired state of the port to be react. For possible states refer to State.
[in]DelayTime in ms for which the thrad passes control to the system.
Returns
Handle of a BitListener object. 0 if creation failed or when the value of the port is not in its range.
Visual Basic Test Code:
Shows the use of these functions:
Dim Listener as long
..
Listener = cvDigIO.BitListenerCreate (0, 1, 1)
cvDigIO.BitListenerStart Listener
...
Private Sub cvDigIO_BitListener(ByVal BitListener As Long, ByVal Port As Long, ByVal Value As CVDIGIOLib.State)
// stop listener
cvDigIO.BitListenerStop Listener
End Sub
...
cvDigIO.BitListenerDestroy Listener
void Listener(__int3264 Listener, long Port, State Value)
This event is fired when the monitoring listener thread, which was started with BitListenerStart or D...
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitListenerDestroy()

boolean BitListenerDestroy ( __int3264  BitListener)

Destroys a BitListener which was created with the BitListenerCreate method.

Parameters
[in]BitListenerHandle of the BitListender object.
Returns
TRUE, if BitListener was destroyed successfully, FALSE otherwise.
Related Topics:
BitListenerCreate
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitListenerStart()

boolean BitListenerStart ( __int3264  BitListener)

Starts a BitListener which was created with the BitListenerCreate method.

Parameters
[in]BitListenerHandle of the BitListender object.
Returns
TRUE, if BitListener was started correctly, FALSE if BitListener was NOT started.
Related Topics:
BitListenerCreate
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitListenerStop()

boolean BitListenerStop ( __int3264  BitListener)

Stops a BitListener created with the BitListenerCreate method.

Parameters
[in]BitListenerHandle of the BitListender object.
Returns
TRUE, if BitListener was stopped correctly, FALSE if BitListener was NOT stopped.
Related Topics:
BitListenerCreate
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitTogglerCreate()

__int3264 BitTogglerCreate ( long  Port,
long  Delay 
)

Creates a BitToggler object and invert the state of an output port for a specific period of time.

   The method creates a thread in which the inversion takes place. This thread is not started until the \ref BitTogglerStart method is called.
   The port is then inverted immediately and reset to its original state after the specified time. 
   The \ref BitTogglerStart returns control to an application immediately and does not wait until the thread is finished.
   When the inversion is completed and the port has been restored the \ref Toggler event is fired. The user can respond to this event.
   To generate another pulse, \ref BitTogglerStart has to be called again.
Important Information on Delay parameter:
Internally, the thread uses the operation sysem sleep function. A BitToggler can not be used to generate exact pulse lengts, because the actual inversion time depends on the system workload. If this method is used to trigger external devices, it is recommended to use the first transition of the pulse to achieve a higher accuracy.
Parameters
[in]PortPort to be inverted. Value ranges from 0 to NumInputs - 1.
[in]DelayInversion time in ms.
Returns
Handle of a BitToggler object. 0 if creation failed or when the value of the port is not in its range.
Related Topics:
Toggler event
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitTogglerDestroy()

boolean BitTogglerDestroy ( __int3264  BitToggler)

Destroys a BitToggler which was created with the BitTogglerCreate method.

Parameters
[in]BitTogglerHandle of the BitToggler object.
Returns
TRUE if BitToggler was destroyed successfully, FALSE otherwise.
Related Topics:
BitTogglerCreate
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ BitTogglerStart()

boolean BitTogglerStart ( __int3264  BitToggler)

Starts a BitToggler which was created with the BitTogglerCreate method.

Parameters
[in]BitTogglerHandle of the BitToggler object.
Returns
TRUE, if BitToggler was started correctly, FALSE if BitToggler was NOT started.
Related Topics:
BitTogglerCreate
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ DWORDListenerCreate()

__int3264 DWORDListenerCreate ( long  Port,
long  Value,
long  Delay 
)

Creates a DWORDListener object and initiate monitoring of an individual input group port.

The method creates a thread in which the group port is monitored. This thread is not started until the DWORDListenerStart method is called. The group port is then interrogated continously. To prevent that the system dedicating too much processor time to the DWORDListener the thread passes control to the system for 'Delay' milliseconds. If the thread detects the required state of the port it triggers the Listener event. Then the user can respond to this event.

Attention
The thread should be stopped with the DWORDListenerStop, otherwise the port remains in its state then and the Listener event continue to be fired.
A DWORDListener object is destroyed with DWORDListenerDestroy method.
This function operates in a similar way to the BitListenerCreate function except they control port groups.
Important Information on Delay parameter:
Internally, the thread uses the operating system sleep function. A value of 0 is allowed altough it means that other threads receive verly little CPU time and the system workload totals nearly 100%.
Therefore it is best to choose a value greater than 0. When the system workload is low, a value of 1 was found to be optimal.
Parameters
[in]PortGroup port to be monitored.
[in]ValueRequired state of the group port to be react.
[in]DelayTime in ms for which the thrad passes control to the system.
Returns
Handle of a DWORDListener object. 0 if creation failed or when the value of the group port is not in its range.
Related Topics:
BitListenerCreate, Listener event

◆ DWORDListenerDestroy()

boolean DWORDListenerDestroy ( __int3264  DWORDListener)

Destroys a DWORDListener which was created with the DWORDListenerCreate method.

Attention
This function operates in a similar way to the BitListenerDestroy function except they control port groups.
Parameters
[in]DWORDListenerHandle of the DWORDListener object.
Returns
TRUE, if DWORDListener was destroyed successfully, FALSE otherwise.
Related Topics:
BitListenerDestroy
Examples:
Delphi - Delphi Digital I/O Example
Visual Basic - VB Digital I/O Example
Visual C++ - VC Digital I/O Example

◆ DWORDListenerStart()

boolean DWORDListenerStart ( __int3264  DWORDListener)

Starts a DWORDListener which was created with the DWORDListenerCreate method.

Attention
This function operates in a similar way to the BitListenerStart function except they control port groups.
Parameters
[in]DWORDListenerHandle of the DWORDListener object.
Returns
TRUE, if DWORDListener was started correctly, FALSE if DWORDListener was NOT started.
Related Topics:
BitListenerStart

◆ DWORDListenerStop()

boolean DWORDListenerStop ( __int3264  DWORDListener)

Stops a DWORDListener created with the BitListenerCreate method.

Attention
This function operates in a similar way to the BitListenerStart function except they control port groups.
Parameters
[in]DWORDListenerHandle of the DWORDListener object.
Returns
TRUE, if DWORDListener was stopped correctly, FALSE if DWORDListener was NOT stopped.
Related Topics:
BitListenerStop

◆ GetInBit()

State GetInBit ( long  Port)

Return the state of an input port.

Parameters
[in]PortInput port to be read in the range from 0 to NumInputs - 1.
Returns
Current port status.

◆ GetInDWORD()

long GetInDWORD ( long  PortGroup)

Return the state of an input port group.

Parameters
[in]PortGroupInput port group to be read.
Returns
Current port group status.

◆ GetOutBit()

State GetOutBit ( long  Port)

Return the state of an output port.

Parameters
[in]PortOutput port to be read in the range from 0 to NumOutput - 1.
Returns
Current port status.

◆ GetOutDWORD()

long GetOutDWORD ( long  PortGroup)

Return the state of an output port group.

Parameters
[in]PortGroupOutput port group to be read.
Returns
Current port group status.

◆ SetOutBit()

State SetOutBit ( long  Port,
State  Value 
)

Sets the state of an output port.

Parameters
[in]PortOutput port to be set. The
[in]ValueValid port number between 0 and NumInputs - 1.
Returns
Current port status.
Example Code:
void CVCDigOTestDlg::SetupUI (void)
{
m_Img = (IMG) m_cvImg.GetImage(); // save image handle
// set DigIO image
m_cvDig.SetImage(reinterpret_cast<intptr_t>(m_Img));
}
void CVCDigOTestDlg::OnButton1()
{
//Set Bit 0 to logic Hi
m_cvDig.SetOutBit(0,1);
//Set Bit 1 to logic Low
m_cvDig.SetOutBit(1,0);
}

◆ SetOutDWORD()

long SetOutDWORD ( long  PortGroup,
long  Value,
long  Mask 
)

Sets the state of an output port group.

Parameters
[in]PortGroupOutput port group to be set.
[in]ValueGroup port value.
[in]MaskMask to be used. It describes which bits are to be written.
Returns
Current port group status.