MATES / Modular Automatic Test Equipment System API  2.5.0.0
Public Member Functions | Data Fields | Properties
Dac5Node Class Reference

Represents single MATES-DAC5-MK1 node. More...

Public Member Functions

override double GetDacMaximum (int channel)
 Get the maximum allowable value of the DAC. More...
 
override double GetDacMinimum (int channel)
 Get the minimum allowable value of the DAC. More...
 
void SetDac (int channel, double voltage)
 Set the value of the DAC. Takes calibration data into account. More...
 
void SetDacRaw (int channel, int val)
 Set raw value of the DAC. More...
 
double GetDac (int channel)
 Get the value of the DAC. More...
 
bool IsCanBridge ()
 Check if this node acts as a CAN bridge (it is connected directly to PC). More...
 
int GetStatusRegister ()
 Get the value of the status register. More...
 
int GetRegisterI (RegisterNumber reg)
 Get regular (integral) MATES register. More...
 
float GetRegisterF (RegisterNumber reg)
 Get floating point MATES register. More...
 
void SetRegisterI (RegisterNumber reg, int val)
 Set regular (integral) MATES register. More...
 
void SetRegisterF (RegisterNumber reg, float val)
 Set floating point MATES register. More...
 
void RegisterEquals (RegisterNumber register, int value)
 Asserts that the specified integral register has the specified value. More...
 
void RegisterEquals (RegisterNumber register, float value)
 Asserts that the specified floating point register has the specified value. More...
 
void LampTest ()
 Execute lamp test. More...
 
string NodeInfo ()
 Get node information as string. More...
 

Data Fields

RegList Registers
 The registers that are associated with this node. Populated by the node constructor. More...
 

Properties

int SerialNumber [get]
 Holds the device serial number. More...
 
string NodeIdName [get]
 Get string representation of this node Id (NodeId). More...
 
string NodeName [get]
 Get node name of this node. More...
 

Detailed Description

Represents single MATES-DAC5-MK1 node.

The Dac5Node constructor is not intended to be called directly. Use Mates.NewDac5Node instead.

Member Function Documentation

override double GetDacMaximum ( int  channel)
virtual

Get the maximum allowable value of the DAC.

Parameters
channelThe DAC channel number [0,39]
Returns
The DAC maximum value in Volts.

Implements DacNode.

override double GetDacMinimum ( int  channel)
virtual

Get the minimum allowable value of the DAC.

Parameters
channelThe DAC channel number [0,39]
Returns
The DAC minimum value in Volts.

Implements DacNode.

void SetDac ( int  channel,
double  voltage 
)
inherited

Set the value of the DAC. Takes calibration data into account.

Parameters
channelThe DAC channel number [0,39]
voltageThe voltage value to set (Volts).

Example usage (mates_test_03.cs):

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Viresco.Mates;
namespace unit_tests
{
[TestClass]
public class mates_test_03
{
[TestMethod]
public void TestMethod()
{
using (Mates mates = new Mates("mates_REMOTE.mon", 1))
{
try
{
Dac5Node dac = mates.NewDac5Node(NodeId.mates_dac5_mk1_1);
Adc5Node adc = mates.NewAdc5Node(NodeId.mates_adc5_mk1_1);
// Assume there is loopback between DAC and ADC.
dac.SetDac(5, 1.0);
double check = adc.GetAdc(5);
Assert.IsTrue(check >= 0.99 && check <= 1.01);
}
catch
{
Console.Write("Cannot discover node.\n");
}
}
}
}
}

Implements IDacNode.

void SetDacRaw ( int  channel,
int  val 
)
inherited

Set raw value of the DAC.

Parameters
channelThe DAC channel number [0,39].
valThe raw DAC binary code to write.

Example usage (mates_test_04.cs):

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Viresco.Mates;
namespace unit_tests
{
[TestClass]
public class mates_test_04
{
[TestMethod]
public void TestMethod()
{
using (Mates mates = new Mates("mates_REMOTE.mon", 1))
{
try
{
Dac5Node dac = mates.NewDac5Node(NodeId.mates_dac5_mk1_1);
// Set the first channel to the half of the range.
dac.SetDacRaw(0, 65536 / 2);
}
catch
{
Console.Write("Cannot discover node.\n");
}
}
}
}
}

Implements IDacNode.

double GetDac ( int  channel)
inherited

Get the value of the DAC.

Parameters
channelThe DAC channel number [0,39]
Returns
The DAC value in Volts.

Implements IDacNode.

bool IsCanBridge ( )
inherited

Check if this node acts as a CAN bridge (it is connected directly to PC).

Returns
True if CAN bridge, otherwise false.
int GetStatusRegister ( )
inherited

Get the value of the status register.

Returns
The REG_COMMON_SR register value.
int GetRegisterI ( RegisterNumber  reg)
inherited

Get regular (integral) MATES register.

Parameters
regThe register number to access (see Viresco.Mates.Registers.RegisterNumber).
Returns
The register value.
float GetRegisterF ( RegisterNumber  reg)
inherited

Get floating point MATES register.

Parameters
regThe register number to access (see Viresco.Mates.Registers.RegisterNumber).
Returns
The register value.
void SetRegisterI ( RegisterNumber  reg,
int  val 
)
inherited

Set regular (integral) MATES register.

Parameters
regThe register number to access (see Viresco.Mates.Registers.RegisterNumber).
valThe register value.
void SetRegisterF ( RegisterNumber  reg,
float  val 
)
inherited

Set floating point MATES register.

Parameters
regThe register number to access (see Viresco.Mates.Registers.RegisterNumber).
valThe register value.
void RegisterEquals ( RegisterNumber  register,
int  value 
)
inherited

Asserts that the specified integral register has the specified value.

Parameters
registerThe register number.
valueThe expected value.

Implements INodeAsserts.

void RegisterEquals ( RegisterNumber  register,
float  value 
)
inherited

Asserts that the specified floating point register has the specified value.

Parameters
registerThe register number.
valueThe expected value.

Implements INodeAsserts.

void LampTest ( )
inherited

Execute lamp test.

Example usage (mates_test_11.cs):

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Viresco.Mates;
namespace unit_tests
{
[TestClass]
public class mates_test_11
{
[TestMethod]
public void TestMethod()
{
using (Mates mates = new Mates("mates_REMOTE.mon", 1))
{
try
{
Dio3Node dio = mates.NewDio3Node(NodeId.mates_dio3_mk1_1);
// Locate node by blinking its LEDs.
dio.LampTest();
}
catch
{
Console.Write("Cannot discover node.\n");
}
}
}
}
}
string NodeInfo ( )
inherited

Get node information as string.

Returns
The node information.

Example usage (mates_test_13.cs):

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Viresco.Mates;
namespace unit_tests
{
[TestClass]
public class mates_test_13
{
[TestMethod]
public void TestMethod()
{
using (Mates mates = new Mates("mates_REMOTE.mon", 1))
{
try
{
UccNode dio = mates.NewUccNode(NodeId.mates_ucc_mk1_1);
// Get node info and print to console.
string info = dio.NodeInfo();
Console.Write(info);
}
catch
{
Console.Write("Cannot discover node.\n");
}
}
}
}
}

Field Documentation

RegList Registers
inherited

The registers that are associated with this node. Populated by the node constructor.

Property Documentation

int SerialNumber
getinherited

Holds the device serial number.

string NodeIdName
getinherited

Get string representation of this node Id (NodeId).

string NodeName
getinherited

Get node name of this node.


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