MityDSP Documentation Index
tcDspCs552x

Introduction

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.

See also:
MityDSP::tcDspCs552x Class Reference

Example

This is a simple example of tcDspCs552x creation and usage:

{
// This class controls the MityDSP chip select functionality.
// This functionality is generally specific to a MityDSP application.
class tcChipSel : public tcDspOutputLatch
{
public:
typedef enum
{
...
eeADC_CS,
...
} teOutputs;
// this method manages the CS output latch for various devices
int SetOuput(unsigned int ID, unsigned int Value);
}
#define MY_CSID 3
int main (int argc, char *argv[])
{
LCK_Handle McBSP_lock = LCK_create(NULL);
tcChipSel Chipsel;
tcDspMcbspConfig McBSP_config;
tcDspMcbsp *McBSP;
tcDspCs552x *a2d;
// change non-default McBSP params
McBSP_config.rx_word_len = WORD_LENGTH_16;
McBSP_config.tx_fsync = CLK_MODE_INT;
// create McBSP interface, with locking
McBSP = new tcDspMcbsp (0x018C0000, &McBSP_config, McBSP_lock);
// set initial ADC configuration
tcDspCs552x::tuConfigReg_t a2d_config;
a2d_config.mnLword = 0;
a2d_config.msBits.CFS = tcDspCs552x::CHOP_256;
a2d_config.msBits.MCb = tcDspCs552x::MC_SINGLE;
a2d_config.msBits.LPb = tcDspCs552x::LOOP_ONCE;
a2d_config.msBits.RCb = tcDspCs552x::RC_WAIT;
a2d_config.msBits.DPTR = tcDspCs552x::DP_2;
a2d_config.msBits.PSSb = tcDspCs552x::PSS_STANDBY;
a2d_config.msBits.PDb = 0;
a2d_config.msBits.PSRb = tcDspCs552x::PSR_RUN;
a2d_config.msBits.LPMb = tcDspCs552x::LPM_NORMAL;
a2d_config.msBits.RSb = tcDspCs552x::RS_NORMAL;
// create CS552x instance
a2d = new DSP_CS552X(McBSP, a2d_config, McBSP_lock, &Chipsel, MY_CSID);
unsigned int my_data[4];
tcDspCs552x::tuSetupReg setup;
tcDspTimer myTimer;
// read all 4 channels
for (int i=0; i<4; i++)
{
myTimer.set(SETTLING_TIME);
// configure the set-up register
setup.lword = 0;
setup.bits.CS_A = i;
setup.bits.WR_A = tcDspCs552x::WR_15_0_HZ;
setup.bits.GB_A = tcDspCs552x::G_25MV;
setup.bits.UBb_A = tcDspCs552x::UB_BIPOLAR;
setup.bits.CS_B = i;
setup.bits.WR_B = tcDspCs552x::WR_15_0_HZ;
setup.bits.GB_B = tcDspCs552x::G_25MV;
setup.bits.UBb_B = tcDspCs552x::UB_BIPOLAR;
a2d->write_setup_reg(setup);
// request a read and wait for it
a2d->request_data();
myTimer.sleep();
my_data[i] = a2d->read_data();
}
...
}
}

  
Generated on Mon Apr 22 2013 11:33:02 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.