Lindholm Engineers / Mbed 2 deprecated Ultrasonic_Firmware

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

TDC7200 Class Reference

TDC7200 Class Reference

TDC7200 class The TDC7200 class is a chip function manifest. More...

#include <TDC7200.h>

Public Member Functions

 TDC7200 (PinName EN=p29, PinName INTRPT=p30, PinName MISO=p12, PinName MOSI=p11, PinName SCLK=p13, PinName SPICS=p14)
 The constructor takes all the pinout data.
bool readToggleSetting (SettingChoice7200)
 ReadToggleSetting The read toggle setting function reads a toggle setting.
void setToggle (SettingChoice7200)
 setToggle function This toggle function is very similar to the readToggle function, except that instead of simply reading the setting value, it changes it.
int readMODE_SELECT ()
 More specific functions.
int readCALIBRATION2_PERIODS ()
 CALIBRATION2_PERIODS This setting controls how many clock cycles the second calibration measurement will go through.
int readAVG_CYCLES ()
 AVG_CYCLES The setting for the number of measurement cycles the chip will average a reading through.
int readNUM_STOP ()
 NUM_STOP This setting is the number of stop signals the TDC7200 expects to see.
bool read_EN ()
 Maintenance Functions.
void interruptReceived ()
 The interrupt function.
void setClockFrequencyIn (int)
 The clock frequency in.
int readCalibrationPeriods ()
 Other miscellaneous values.
double readTimeOfFlight (int)
 for readTimeOfFlight, the parameter is WHICH time-of-flight you want.
void forceMeasurementRead ()
 Finally, the two functions I want to use the most.

Data Fields

TI_Registers tdc7200_registers
 Please don't go mucking about in the registers if you don't know what you're doing.

Detailed Description

TDC7200 class The TDC7200 class is a chip function manifest.

It controls and manipulates settings, counters, interrupts, and masks. This file assumes that the appropriate pins are linked to the MCU. Also, any setting that is set to an invalid number will be set instead to the default. It should be noted that the TDC7200 gets its accuracy from the accuracy of its clock driver. So, a clock signal that varies by even 1% may give highly inaccurate times. Pinout Table from the TDC7200: 1 | Enable pin. Turns chip on or off. 8 | Interrupt pin. Signals when an event happens. 9 | MISO pin. Goes to SPI driver. 10 | MOSI pin. Goes to SPI driver. 11 | Chip select pin. Part of SPI system, but can go to any I/O pin. 12 | Serial clock pin. Part of SPI system, goes to SPI driver.

Definition at line 37 of file TDC7200.h.


Constructor & Destructor Documentation

TDC7200 ( PinName  EN = p29,
PinName  INTRPT = p30,
PinName  MISO = p12,
PinName  MOSI = p11,
PinName  SCLK = p13,
PinName  SPICS = p14 
)

The constructor takes all the pinout data.

Definition at line 11 of file TDC7200.cpp.


Member Function Documentation

void forceMeasurementRead (  )

Finally, the two functions I want to use the most.

Definition at line 236 of file TDC7200.cpp.

void interruptReceived (  )

The interrupt function.

Definition at line 163 of file TDC7200.cpp.

bool read_EN (  )

Maintenance Functions.

The enable pin The enable pin is actually a little weird. This pin has to be set to off when the chip initially receives power, then turned on for the chip to work.

Definition at line 152 of file TDC7200.cpp.

int readAVG_CYCLES (  )

AVG_CYCLES The setting for the number of measurement cycles the chip will average a reading through.

The number of cycles is equal to 2 ^ (setting value)

Definition at line 108 of file TDC7200.cpp.

int readCALIBRATION2_PERIODS (  )

CALIBRATION2_PERIODS This setting controls how many clock cycles the second calibration measurement will go through.

--- setting value | Actual number of cycles 0 | 2 1 | 10 2 | 20 3 | 40

Definition at line 70 of file TDC7200.cpp.

int readCalibrationPeriods (  )

Other miscellaneous values.

Definition at line 211 of file TDC7200.cpp.

int readMODE_SELECT (  )

More specific functions.

MODE_SELECT There are two modes for this chip: mode 1 and mode 2. Mode 1 is for when your expected time-of-flight is less than about twenty clock cycles (~500 ns). Mode 2 is for when your expected time-of-flight is higher than that. But still probably less than 2000 clock cycles. The reason this isn't a toggle function is that this chip has the ability to have more than two modes. But they aren't listed in the documentation.

Definition at line 49 of file TDC7200.cpp.

int readNUM_STOP (  )

NUM_STOP This setting is the number of stop signals the TDC7200 expects to see.

It can only count up to five stop signals, though. A value of zero is one stop, one means two stops, and so on.

Definition at line 130 of file TDC7200.cpp.

double readTimeOfFlight ( int  index = 0 )

for readTimeOfFlight, the parameter is WHICH time-of-flight you want.

Definition at line 227 of file TDC7200.cpp.

bool readToggleSetting ( SettingChoice7200  choice )

ReadToggleSetting The read toggle setting function reads a toggle setting.

NOTICE: a value of 'true' does not always mean the setting is on. Chart for toggle settings: FORCE_CAL | Ensures chip performs calibration, even after an interrupted measurement (default off) PARITY_EN | Turns on the parity bits for the results (default off) TRIGG_EDGE | Changes between using the rising edge for the trigger or the falling edge (default rising edge) STOP_EDGE | Changes between using the rising edge for the stop signal or the falling edge (default rising edge) START_EDGE | Changes between using the rising edge for the start signal or the falling edge (default rising edge) START_MEAS | Tells the chip to begin a new measurement, also resets results registers (default off) CLOCK_CNTR_OVF_MASK | Turns on the interrupt for the clock counter overflow (default enabled) COARSE_CNTR_OVF_MASK | Turns on the interrupt for the coarse counter overflow (default enabled) NEW_MEAS_MASK | turns on the interrupt for when a new measurement is completed (default enabled)

Parameters:
choiceindicates which setting should be changed.

Definition at line 36 of file TDC7200.cpp.

void setClockFrequencyIn ( int  newFreq )

The clock frequency in.

Definition at line 203 of file TDC7200.cpp.

void setToggle ( SettingChoice7200  choice )

setToggle function This toggle function is very similar to the readToggle function, except that instead of simply reading the setting value, it changes it.

If the value was on, this function turns it off, and if it was off, this function turns it on. Just like how toggles should work.

Parameters:
choiceChoice indicates which setting you want to toggle.

Definition at line 42 of file TDC7200.cpp.


Field Documentation

TI_Registers tdc7200_registers

Please don't go mucking about in the registers if you don't know what you're doing.

Definition at line 44 of file TDC7200.h.