AP&C API Reference
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | List of all members
Apac.TcTec.Top16.Top16 Class Reference

More...

Inheritance diagram for Apac.TcTec.Top16.Top16:

Public Member Functions

byte ReadOutputSetting (int output)
 After calling SetOutputsSame or SetOutputsDistinct this method will retrieve the state of output . More...
 
ushort ReadLastAnalogValue (int input)
 After calling GetAnalogInputs this method will retrieve the state of input . More...
 
byte ReadLastDigitalValue (int index)
 After calling GetDigitalInputs this method will return the latest digital reading for the port at index . More...
 
void SetOutputsSame (byte mask, byte set)
 Sets multiple outputs at once according to mask to the value of set , and tracks the state of all outputs after the set. Use a mask of 0 and a set of 0 to get the initial state of all outputs. If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
void SetOutputsDistict (byte mask, byte set)
 Sets multiple outputs at once according to mask while allowing each set output to assume a distinct value. If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
void SetPulseWidthModulation (byte output, byte pwm)
 Sets the pulse width modulation for the given output. If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
void GetDigitialInputs ()
 Reads the digital input values (0/1) from all input ports. Upon completion the results are available with GetLastDigitalValue(int). If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
void GetAnalogInputs (Gain gain)
 Reads the analog input values from all input ports. Upon completion the results are available with GetLastAnalogValue(int). If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
ushort GetAnalogInput (short input, Gain gain)
 Reads one analog input port value from the Top16 and returns the reading. If communications with the board is not open, this method will open it, set the outputs and then close communications again. More...
 
void OpenBoard ()
 Opens the board for communications. More...
 
void CloseBoard ()
 Closes the communications with the board and releases resources. More...
 
void Dispose ()
 
override string ToString ()
 

Static Public Member Functions

static void Initialize ()
 Searches for all attached TCTEC Top16 boards. More...
 
static void Release ()
 
static int DllVersion ()
 Retrieves the version number of the top16.dll from TCTEC. More...
 
static Top16 Find (Predicate< Top16 > predicate)
 
static List< Top16FindAll (Predicate< Top16 > predicate)
 

Static Public Attributes

static log4net.ILog _log = log4net.LogManager.GetLogger(typeof(Top16))
 
static readonly byte NUM_OUTPUTS = 8
 
static readonly byte NUM_INPUTS = 8
 

Protected Member Functions

virtual void Dispose (bool disposeManagedResources)
 

Properties

static IEnumerable< Top16Boards [get]
 Allows access to each Top16 instance that was found during Initialize. More...
 
string Name [get]
 
string Description [get, set]
 
uint Handle [get]
 
Gain ReadGain [get, set]
 
int UsbTimeoutMs [get, set]
 
uint ReadErrorResetTrigger [get, set]
 
int ReadErrors [get, set]
 

Detailed Description

Provides a safe managed adapter to the unsafe Top16 code, by modelling one Top16DIO board and its interface. This simplifies higher-level code by abstracting away the bit manipulation and the pointer conversion tasks. Load the instances with the static interface of this class.

There are three sets of data managed by this model:

The input readings are available for all input ports depending on how the calling application utilizes the model (by making analog and/or digital calls). The output readings are made available just by setting output values, so the current state of the outputs is always tracked.

Member Function Documentation

◆ CloseBoard()

void Apac.TcTec.Top16.Top16.CloseBoard ( )
inline

Closes the communications with the board and releases resources.

◆ DllVersion()

static int Apac.TcTec.Top16.Top16.DllVersion ( )
inlinestatic

Retrieves the version number of the top16.dll from TCTEC.

Returns
The version number of the TCTEC dll.

◆ GetAnalogInput()

ushort Apac.TcTec.Top16.Top16.GetAnalogInput ( short  input,
Gain  gain 
)
inline

Reads one analog input port value from the Top16 and returns the reading. If communications with the board is not open, this method will open it, set the outputs and then close communications again.

Parameters
inputThe input (0 to number of inputs - 1) to be read.
gainThe gain to use for the amplifier when reading.
Returns
Returns the (12-bit) reading from input .

◆ GetAnalogInputs()

void Apac.TcTec.Top16.Top16.GetAnalogInputs ( Gain  gain)
inline

Reads the analog input values from all input ports. Upon completion the results are available with GetLastAnalogValue(int). If communications with the board is not open, this method will open it, set the outputs and then close communications again.

Parameters
gain

◆ GetDigitialInputs()

void Apac.TcTec.Top16.Top16.GetDigitialInputs ( )
inline

Reads the digital input values (0/1) from all input ports. Upon completion the results are available with GetLastDigitalValue(int). If communications with the board is not open, this method will open it, set the outputs and then close communications again.

◆ Initialize()

static void Apac.TcTec.Top16.Top16.Initialize ( )
inlinestatic

Searches for all attached TCTEC Top16 boards.

Returns
Returns the names of all attached Top16 boards in a List{string}.

◆ OpenBoard()

void Apac.TcTec.Top16.Top16.OpenBoard ( )
inline

Opens the board for communications.

◆ ReadLastAnalogValue()

ushort Apac.TcTec.Top16.Top16.ReadLastAnalogValue ( int  input)
inline

After calling GetAnalogInputs this method will retrieve the state of input .

Parameters
inputThe number of the input (1 - number of inputs) being requested.
Returns
Returns the last retrieved value of the input.

◆ ReadLastDigitalValue()

byte Apac.TcTec.Top16.Top16.ReadLastDigitalValue ( int  index)
inline

After calling GetDigitalInputs this method will return the latest digital reading for the port at index .

Parameters
indexThe index (0 - NUM_INPUTS) of the input port to be checked.
Returns
Returns zero (0), input is low, or one (1) input is high.

◆ ReadOutputSetting()

byte Apac.TcTec.Top16.Top16.ReadOutputSetting ( int  output)
inline

After calling SetOutputsSame or SetOutputsDistinct this method will retrieve the state of output .

Parameters
outputThe number of the output (1 - number of outputs) being requested.
Returns
Returns the last retrieved value of the output.

◆ SetOutputsDistict()

void Apac.TcTec.Top16.Top16.SetOutputsDistict ( byte  mask,
byte  set 
)
inline

Sets multiple outputs at once according to mask while allowing each set output to assume a distinct value. If communications with the board is not open, this method will open it, set the outputs and then close communications again.

Parameters
mask
set

◆ SetOutputsSame()

void Apac.TcTec.Top16.Top16.SetOutputsSame ( byte  mask,
byte  set 
)
inline

Sets multiple outputs at once according to mask to the value of set , and tracks the state of all outputs after the set. Use a mask of 0 and a set of 0 to get the initial state of all outputs. If communications with the board is not open, this method will open it, set the outputs and then close communications again.

Parameters
mask
set

◆ SetPulseWidthModulation()

void Apac.TcTec.Top16.Top16.SetPulseWidthModulation ( byte  output,
byte  pwm 
)
inline

Sets the pulse width modulation for the given output. If communications with the board is not open, this method will open it, set the outputs and then close communications again.

Parameters
outputThe output (1-8) to be manipulated.
pwmThe width of the pulse modulation (0 - 255, 0x00 - 0xff).

Property Documentation

◆ Boards

IEnumerable<Top16> Apac.TcTec.Top16.Top16.Boards
staticget

Allows access to each Top16 instance that was found during Initialize.


The documentation for this class was generated from the following file: