The tcDspCs552x class is used to set up and receive data from a Crystal CS552X family A-to-D converter. More...
#include <core/DspCs552x.h>
Classes | |
struct | tsCR0 |
16384 Hz Chop Frequency More... | |
struct | tsCR1 |
Command Register (8-bits) - with CB = 1. More... | |
union | tuCmdReg |
Command Register (8-bits). More... | |
union | tuConfigReg |
Configuration Register (24-bits). More... | |
union | tuSetupReg |
Set-Up Register (24-bits). More... | |
Public Member Functions | |
tcDspCs552x (tcDspMcbsp *apMcbsp, tuConfigReg auCfg, LCK_Handle ahMcLock=NULL, tcDspOutputLatch *apLatch=NULL, unsigned int anCSID=0) | |
This constructor is used to initialize a CS552x A-to-D converter over the specified McBSP interface. | |
~tcDspCs552x () | |
Default destructor. | |
void | serial_reinit (void) |
This routine writes the serial port re-initialization sequence. | |
tuCmdReg | read_command_reg (void) |
This routine returns the last value sent to the CS552x command register. | |
void | write_config_reg (tuConfigReg auCfg) |
This routine writes a new value to the CS552x config register. | |
tuConfigReg | read_config_reg (void) |
This routine reads the current CS552x config register settings. | |
void | write_setup_reg (tuSetupReg auSetup) |
This routine writes a new value to the CS552x setup register. | |
tuSetupReg | read_setup_reg (void) |
This routine reads the current CS552x setup register settings. | |
void | write_gain_reg (unsigned int anChannel, unsigned int anValue) |
This routine writes a new value to the CS552x gain register for the specified channel. | |
unsigned int | read_gain_reg (unsigned int anChannel) |
This routine returns the current gain value for the specified channel. | |
void | write_offset_reg (unsigned int anChannel, unsigned int anValue) |
This routine writes a new value to the CS552x offset register for the specified channel. | |
unsigned int | read_offset_reg (unsigned int anChannel) |
This routine reads the current CS552x offset register for the specified channel. | |
void | request_data (int type=CC_NORMAL) |
This routine issues a normal conversion request using set-up 0 from the CS552x. | |
unsigned int | read_data (void) |
This routine writes a NULL word to the CS552x in order to retrieve data back from a previous request. | |
void | perform_calibration (int anChannel, int anRate, int anScale, int anMode, bool abSelf, unsigned int *apGain, unsigned int *apOffset) |
This routine performs gain and offset calibration for the specified channel of the CS552x device. | |
void | restore_calibration (int anChannel, unsigned int anGain, unsigned int anOffset) |
This routine restores gain and offset calibration values for the specified channel of the CS552x device. | |
Public Attributes | |
unsigned int | mnConvRequests |
unsigned int | mnConvReads |
Static Public Attributes | |
Command Register Constants | |
static const unsigned int | CS_1 = 0x00 |
static const unsigned int | CS_2 = 0x01 |
Select Channel 1. | |
static const unsigned int | CS_3 = 0x02 |
Select Channel 2. | |
static const unsigned int | CS_4 = 0x03 |
Select Channel 3. | |
static const unsigned int | CS_5 = 0x04 |
Select Channel 4. | |
static const unsigned int | CS_6 = 0x05 |
Select Channel 5. | |
static const unsigned int | CS_7 = 0x06 |
Select Channel 6. | |
static const unsigned int | CS_8 = 0x07 |
Select Channel 7. | |
static const unsigned int | WRITE_SEL = 0x00 |
Select Channel 8. | |
static const unsigned int | READ_SEL = 0x01 |
Write to register. | |
static const unsigned int | RS_OFFSET = 0x01 |
Read from register. | |
static const unsigned int | RS_GAIN = 0x02 |
Select Offset Register. | |
static const unsigned int | RS_CONFIG = 0x03 |
Select Gain Register. | |
static const unsigned int | RS_SETUP = 0x05 |
Select Config Register. | |
static const unsigned int | CSRP_SETUP_1 = 0x00 |
Select Setup Register. | |
static const unsigned int | CSRP_SETUP_2 = 0x01 |
Select Setup 1. | |
static const unsigned int | CSRP_SETUP_3 = 0x02 |
Select Setup 2. | |
static const unsigned int | CSRP_SETUP_4 = 0x03 |
Select Setup 3. | |
static const unsigned int | CSRP_SETUP_5 = 0x04 |
Select Setup 4. | |
static const unsigned int | CSRP_SETUP_6 = 0x05 |
Select Setup 5. | |
static const unsigned int | CSRP_SETUP_7 = 0x06 |
Select Setup 6. | |
static const unsigned int | CSRP_SETUP_8 = 0x07 |
Select Setup 7. | |
static const unsigned int | CSRP_SETUP_9 = 0x08 |
Select Setup 8. | |
static const unsigned int | CSRP_SETUP_10 = 0x09 |
Select Setup 9. | |
static const unsigned int | CSRP_SETUP_11 = 0x0A |
Select Setup 10. | |
static const unsigned int | CSRP_SETUP_12 = 0x0B |
Select Setup 11. | |
static const unsigned int | CSRP_SETUP_13 = 0x0C |
Select Setup 12. | |
static const unsigned int | CSRP_SETUP_14 = 0x0D |
Select Setup 13. | |
static const unsigned int | CSRP_SETUP_15 = 0x0E |
Select Setup 14. | |
static const unsigned int | CSRP_SETUP_16 = 0x0F |
Select Setup 15. | |
static const unsigned int | CC_NORMAL = 0x00 |
Select Setup 16. | |
static const unsigned int | CC_SELF_OFFSET_CAL = 0x01 |
Normal Conversion. | |
static const unsigned int | CC_SELF_GAIN_CAL = 0x02 |
Self-Offset Cal. | |
static const unsigned int | CC_SYS_OFFSET_CAL = 0x05 |
Self-Gain Cal. | |
static const unsigned int | CC_SYS_GAIN_CAL = 0x06 |
System-Offset Cal. | |
Setup Register Constants | |
static const unsigned int | WR_15_0_HZ = 0x00 |
static const unsigned int | WR_30_0_HZ = 0x01 |
Word Rate: 15.0 Hz. | |
static const unsigned int | WR_61_6_HZ = 0x02 |
Word Rate: 30.0 Hz. | |
static const unsigned int | WR_84_5_HZ = 0x03 |
Word Rate: 61.6 Hz. | |
static const unsigned int | WR_101_1_HZ = 0x04 |
Word Rate: 84.5 Hz. | |
static const unsigned int | WR_1_88_HZ = 0x05 |
Word Rate: 101.1 Hz. | |
static const unsigned int | WR_3_76_HZ = 0x06 |
Word Rate: 1.88 Hz. | |
static const unsigned int | WR_7_51_HZ = 0x07 |
Word Rate: 3.76 Hz. | |
static const unsigned int | G_100MV = 0x00 |
Word Rate: 7.51 Hz. | |
static const unsigned int | G_55MV = 0x01 |
Gain: 100 mV. | |
static const unsigned int | G_25MV = 0x02 |
Gain: 55 mV. | |
static const unsigned int | G_1V = 0x03 |
Gain: 25 mV. | |
static const unsigned int | G_5V = 0x04 |
Gain: 1 V. | |
static const unsigned int | G_2_5V = 0x05 |
Gain: 5 V. | |
static const unsigned int | UB_BIPOLAR = 0x00 |
Gain: 2.5 V. | |
static const unsigned int | UB_UNIPOLAR = 0x01 |
Bipolar Measurement. | |
Configuration Register Constants | |
static const unsigned int | RS_NORMAL = 0x00 |
static const unsigned int | RS_RESET = 0x01 |
No Reset. | |
static const unsigned int | PSR_RUN = 0x00 |
Issue Reset. | |
static const unsigned int | PSR_PSAVE = 0x01 |
Running. | |
static const unsigned int | LPM_NORMAL = 0x00 |
Power Save. | |
static const unsigned int | LPM_REDUCED = 0x01 |
Normal Power. | |
static const unsigned int | PSS_STANDBY = 0x00 |
Reduced Power. | |
static const unsigned int | PSS_SLEEP = 0x01 |
Power Save Standby. | |
static const unsigned int | DP_1 = 0x00 |
Power Save Sleep. | |
static const unsigned int | DP_2 = 0x01 |
Depth of 1. | |
static const unsigned int | DP_3 = 0x02 |
Depth of 2. | |
static const unsigned int | DP_4 = 0x03 |
Depth of 3. | |
static const unsigned int | DP_5 = 0x04 |
Depth of 4. | |
static const unsigned int | DP_6 = 0x05 |
Depth of 5. | |
static const unsigned int | DP_7 = 0x06 |
Depth of 6. | |
static const unsigned int | DP_8 = 0x07 |
Depth of 7. | |
static const unsigned int | DP_9 = 0x08 |
Depth of 8. | |
static const unsigned int | DP_10 = 0x09 |
Depth of 9. | |
static const unsigned int | DP_11 = 0x0A |
Depth of 10. | |
static const unsigned int | DP_12 = 0x0B |
Depth of 11. | |
static const unsigned int | DP_13 = 0x0C |
Depth of 12. | |
static const unsigned int | DP_14 = 0x0D |
Depth of 13. | |
static const unsigned int | DP_15 = 0x0E |
Depth of 14. | |
static const unsigned int | DP_16 = 0x0F |
Depth of 15. | |
static const unsigned int | RC_NOWAIT = 0x00 |
Depth of 16. | |
static const unsigned int | RC_WAIT = 0x01 |
Don't wait for read. | |
static const unsigned int | LOOP_ONCE = 0x00 |
Wait for read. | |
static const unsigned int | LOOP_CONTINUOUS = 0x01 |
One Conversion. | |
static const unsigned int | MC_SINGLE = 0x00 |
Continuous Conversions. | |
static const unsigned int | MC_MULTIPLE = 0x01 |
Single Conversion. | |
static const unsigned int | CHOP_256 = 0x00 |
Multiple Conversions. | |
static const unsigned int | CHOP_4096 = 0x00 |
256 Hz Chop Frequency | |
static const unsigned int | CHOP_16384 = 0x00 |
4096 Hz Chop Frequency |
The tcDspCs552x class is used to set up and receive data from a Crystal CS552X family A-to-D converter.
The converter is accessed via a McBSP interface.
tcDspCs552x::tcDspCs552x | ( | tcDspMcbsp * | apMcbsp, | |
tuConfigReg | auCfg, | |||
LCK_Handle | ahMcLock = NULL , |
|||
tcDspOutputLatch * | apLatch = NULL , |
|||
unsigned int | anCSID = 0 | |||
) |
This constructor is used to initialize a CS552x A-to-D converter over the specified McBSP interface.
[in] | apMcbsp | Pointer to a McBSP interface object. |
[in] | auCfg | A tuConfigReg structure for the desired configuration |
[in] | ahMcLock | Option LCK Handle to serialize McBSP access |
[in] | apLatch | A pointer to a tcDspOutputLatch interface that contains control of the chip select line. This can be NULL. |
[in] | anCSID | The ID for the ADC chip select in apLatch. |
tcDspCs552x::~tcDspCs552x | ( | ) |
Default destructor.
void tcDspCs552x::serial_reinit | ( | void | ) |
This routine writes the serial port re-initialization sequence.
tcDspCs552x::tuCmdReg tcDspCs552x::read_command_reg | ( | void | ) |
This routine returns the last value sent to the CS552x command register.
void tcDspCs552x::write_config_reg | ( | tuConfigReg | auCfg | ) |
This routine writes a new value to the CS552x config register.
[in] | auCfg | The desired new configuration for the CS552x |
tcDspCs552x::tuConfigReg tcDspCs552x::read_config_reg | ( | void | ) |
This routine reads the current CS552x config register settings.
void tcDspCs552x::write_setup_reg | ( | tuSetupReg | auSetup | ) |
This routine writes a new value to the CS552x setup register.
[in] | auSetup | The desired new value for the CS552x setup register |
tcDspCs552x::tuSetupReg tcDspCs552x::read_setup_reg | ( | void | ) |
This routine reads the current CS552x setup register settings.
void tcDspCs552x::write_gain_reg | ( | unsigned int | anChannel, | |
unsigned int | anValue | |||
) |
This routine writes a new value to the CS552x gain register for the specified channel.
[in] | anChannel | The channel to modify. |
[in] | anValue | The new gain value to write to the gain register. |
unsigned int tcDspCs552x::read_gain_reg | ( | unsigned int | anChannel | ) |
This routine returns the current gain value for the specified channel.
[in] | anChannel | The channel to read. |
void tcDspCs552x::write_offset_reg | ( | unsigned int | anChannel, | |
unsigned int | anValue | |||
) |
This routine writes a new value to the CS552x offset register for the specified channel.
[in] | anChannel | The channel to modify. |
[in] | anValue | The new value to write to the offset register. |
unsigned int tcDspCs552x::read_offset_reg | ( | unsigned int | anChannel | ) |
This routine reads the current CS552x offset register for the specified channel.
[in] | anChannel | The channel to read. |
void tcDspCs552x::request_data | ( | int | anType = CC_NORMAL |
) |
This routine issues a normal conversion request using set-up 0 from the CS552x.
[in] | anType | The type of request. |
unsigned int tcDspCs552x::read_data | ( | void | ) |
This routine writes a NULL word to the CS552x in order to retrieve data back from a previous request.
Note that the application code must wait long enough to issue this read to ensure that the request has been completed.
void tcDspCs552x::perform_calibration | ( | int | anChannel, | |
int | anRate, | |||
int | anScale, | |||
int | anMode, | |||
bool | abSelf, | |||
unsigned int * | apGain, | |||
unsigned int * | apOffset | |||
) |
This routine performs gain and offset calibration for the specified channel of the CS552x device.
[in] | anChannel | The channel to calibrate. |
[in] | anRate | The word rate for this channel:
|
[in] | anScale | The gain scale for this channel:
|
[in] | anMode | Measurement mode:
|
[in] | abSelf | True for self-gain calibration, false for system-gain. |
[out] | apGain | The value in the gain register after calibration. |
[out] | apOffset | The value in the offset register after calibration. |
void tcDspCs552x::restore_calibration | ( | int | anChannel, | |
unsigned int | anGain, | |||
unsigned int | anOffset | |||
) |
This routine restores gain and offset calibration values for the specified channel of the CS552x device.
[in] | anChannel | The channel to restore. |
[in] | anGain | Value to write back to the gain register. |
[in] | anOffset | Value to write back to the offset register. |
const unsigned int MityDSP::tcDspCs552x::CS_1 = 0x00 [static] |
const unsigned int MityDSP::tcDspCs552x::CS_2 = 0x01 [static] |
Select Channel 1.
const unsigned int MityDSP::tcDspCs552x::CS_3 = 0x02 [static] |
Select Channel 2.
const unsigned int MityDSP::tcDspCs552x::CS_4 = 0x03 [static] |
Select Channel 3.
const unsigned int MityDSP::tcDspCs552x::CS_5 = 0x04 [static] |
Select Channel 4.
const unsigned int MityDSP::tcDspCs552x::CS_6 = 0x05 [static] |
Select Channel 5.
const unsigned int MityDSP::tcDspCs552x::CS_7 = 0x06 [static] |
Select Channel 6.
const unsigned int MityDSP::tcDspCs552x::CS_8 = 0x07 [static] |
Select Channel 7.
const unsigned int MityDSP::tcDspCs552x::WRITE_SEL = 0x00 [static] |
Select Channel 8.
const unsigned int MityDSP::tcDspCs552x::READ_SEL = 0x01 [static] |
Write to register.
const unsigned int MityDSP::tcDspCs552x::RS_OFFSET = 0x01 [static] |
Read from register.
const unsigned int MityDSP::tcDspCs552x::RS_GAIN = 0x02 [static] |
Select Offset Register.
const unsigned int MityDSP::tcDspCs552x::RS_CONFIG = 0x03 [static] |
Select Gain Register.
const unsigned int MityDSP::tcDspCs552x::RS_SETUP = 0x05 [static] |
Select Config Register.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_1 = 0x00 [static] |
Select Setup Register.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_2 = 0x01 [static] |
Select Setup 1.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_3 = 0x02 [static] |
Select Setup 2.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_4 = 0x03 [static] |
Select Setup 3.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_5 = 0x04 [static] |
Select Setup 4.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_6 = 0x05 [static] |
Select Setup 5.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_7 = 0x06 [static] |
Select Setup 6.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_8 = 0x07 [static] |
Select Setup 7.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_9 = 0x08 [static] |
Select Setup 8.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_10 = 0x09 [static] |
Select Setup 9.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_11 = 0x0A [static] |
Select Setup 10.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_12 = 0x0B [static] |
Select Setup 11.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_13 = 0x0C [static] |
Select Setup 12.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_14 = 0x0D [static] |
Select Setup 13.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_15 = 0x0E [static] |
Select Setup 14.
const unsigned int MityDSP::tcDspCs552x::CSRP_SETUP_16 = 0x0F [static] |
Select Setup 15.
const unsigned int MityDSP::tcDspCs552x::CC_NORMAL = 0x00 [static] |
Select Setup 16.
const unsigned int MityDSP::tcDspCs552x::CC_SELF_OFFSET_CAL = 0x01 [static] |
Normal Conversion.
const unsigned int MityDSP::tcDspCs552x::CC_SELF_GAIN_CAL = 0x02 [static] |
Self-Offset Cal.
const unsigned int MityDSP::tcDspCs552x::CC_SYS_OFFSET_CAL = 0x05 [static] |
Self-Gain Cal.
const unsigned int MityDSP::tcDspCs552x::CC_SYS_GAIN_CAL = 0x06 [static] |
System-Offset Cal.
const unsigned int MityDSP::tcDspCs552x::WR_15_0_HZ = 0x00 [static] |
const unsigned int MityDSP::tcDspCs552x::WR_30_0_HZ = 0x01 [static] |
Word Rate: 15.0 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_61_6_HZ = 0x02 [static] |
Word Rate: 30.0 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_84_5_HZ = 0x03 [static] |
Word Rate: 61.6 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_101_1_HZ = 0x04 [static] |
Word Rate: 84.5 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_1_88_HZ = 0x05 [static] |
Word Rate: 101.1 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_3_76_HZ = 0x06 [static] |
Word Rate: 1.88 Hz.
const unsigned int MityDSP::tcDspCs552x::WR_7_51_HZ = 0x07 [static] |
Word Rate: 3.76 Hz.
const unsigned int MityDSP::tcDspCs552x::G_100MV = 0x00 [static] |
Word Rate: 7.51 Hz.
const unsigned int MityDSP::tcDspCs552x::G_55MV = 0x01 [static] |
Gain: 100 mV.
const unsigned int MityDSP::tcDspCs552x::G_25MV = 0x02 [static] |
Gain: 55 mV.
const unsigned int MityDSP::tcDspCs552x::G_1V = 0x03 [static] |
Gain: 25 mV.
const unsigned int MityDSP::tcDspCs552x::G_5V = 0x04 [static] |
Gain: 1 V.
const unsigned int MityDSP::tcDspCs552x::G_2_5V = 0x05 [static] |
Gain: 5 V.
const unsigned int MityDSP::tcDspCs552x::UB_BIPOLAR = 0x00 [static] |
Gain: 2.5 V.
const unsigned int MityDSP::tcDspCs552x::UB_UNIPOLAR = 0x01 [static] |
Bipolar Measurement.
const unsigned int MityDSP::tcDspCs552x::RS_NORMAL = 0x00 [static] |
const unsigned int MityDSP::tcDspCs552x::RS_RESET = 0x01 [static] |
No Reset.
const unsigned int MityDSP::tcDspCs552x::PSR_RUN = 0x00 [static] |
Issue Reset.
const unsigned int MityDSP::tcDspCs552x::PSR_PSAVE = 0x01 [static] |
Running.
const unsigned int MityDSP::tcDspCs552x::LPM_NORMAL = 0x00 [static] |
Power Save.
const unsigned int MityDSP::tcDspCs552x::LPM_REDUCED = 0x01 [static] |
Normal Power.
const unsigned int MityDSP::tcDspCs552x::PSS_STANDBY = 0x00 [static] |
Reduced Power.
const unsigned int MityDSP::tcDspCs552x::PSS_SLEEP = 0x01 [static] |
Power Save Standby.
const unsigned int MityDSP::tcDspCs552x::DP_1 = 0x00 [static] |
Power Save Sleep.
const unsigned int MityDSP::tcDspCs552x::DP_2 = 0x01 [static] |
Depth of 1.
const unsigned int MityDSP::tcDspCs552x::DP_3 = 0x02 [static] |
Depth of 2.
const unsigned int MityDSP::tcDspCs552x::DP_4 = 0x03 [static] |
Depth of 3.
const unsigned int MityDSP::tcDspCs552x::DP_5 = 0x04 [static] |
Depth of 4.
const unsigned int MityDSP::tcDspCs552x::DP_6 = 0x05 [static] |
Depth of 5.
const unsigned int MityDSP::tcDspCs552x::DP_7 = 0x06 [static] |
Depth of 6.
const unsigned int MityDSP::tcDspCs552x::DP_8 = 0x07 [static] |
Depth of 7.
const unsigned int MityDSP::tcDspCs552x::DP_9 = 0x08 [static] |
Depth of 8.
const unsigned int MityDSP::tcDspCs552x::DP_10 = 0x09 [static] |
Depth of 9.
const unsigned int MityDSP::tcDspCs552x::DP_11 = 0x0A [static] |
Depth of 10.
const unsigned int MityDSP::tcDspCs552x::DP_12 = 0x0B [static] |
Depth of 11.
const unsigned int MityDSP::tcDspCs552x::DP_13 = 0x0C [static] |
Depth of 12.
const unsigned int MityDSP::tcDspCs552x::DP_14 = 0x0D [static] |
Depth of 13.
const unsigned int MityDSP::tcDspCs552x::DP_15 = 0x0E [static] |
Depth of 14.
const unsigned int MityDSP::tcDspCs552x::DP_16 = 0x0F [static] |
Depth of 15.
const unsigned int MityDSP::tcDspCs552x::RC_NOWAIT = 0x00 [static] |
Depth of 16.
const unsigned int MityDSP::tcDspCs552x::RC_WAIT = 0x01 [static] |
Don't wait for read.
const unsigned int MityDSP::tcDspCs552x::LOOP_ONCE = 0x00 [static] |
Wait for read.
const unsigned int MityDSP::tcDspCs552x::LOOP_CONTINUOUS = 0x01 [static] |
One Conversion.
const unsigned int MityDSP::tcDspCs552x::MC_SINGLE = 0x00 [static] |
Continuous Conversions.
const unsigned int MityDSP::tcDspCs552x::MC_MULTIPLE = 0x01 [static] |
Single Conversion.
const unsigned int MityDSP::tcDspCs552x::CHOP_256 = 0x00 [static] |
Multiple Conversions.
const unsigned int MityDSP::tcDspCs552x::CHOP_4096 = 0x00 [static] |
256 Hz Chop Frequency
const unsigned int MityDSP::tcDspCs552x::CHOP_16384 = 0x00 [static] |
4096 Hz Chop Frequency
unsigned int MityDSP::tcDspCs552x::mnConvRequests |
unsigned int MityDSP::tcDspCs552x::mnConvReads |