/
//eAIN
/Take a single-ended measurement from AIN3.
(Handle, ChannelP, ChannelN, *Voltage, Range, Resolution,
served1, Reserved2)
/eDAC (Handle, Channel, Voltage, Binary, Reserved1, Reserved2)
e, 0, 3.1, 0, 0, 0);
DO(lngHandle, 3, 1);
1 output timer and 1 input timer, and enable Counter0.
h the desired values, then make the call.
/ TimerClockBaseIndex, TimerClockDivisor, *aTimerModes,
nd re er1), read and reset Counter0, and update
lue ( er (Timer0).
he ar ues, then make the call.
reset Timer1
n
/ Reserved2);
oudest. The frequency of the signal sent to the buzzer is
ery n iterations of the main U3 firmware loop. The following
r:
// Settling, Binary, Re
//
eAIN(lngHandle, 3, 31, &dblVoltage, 0, 0, 0, 0, 0, 0);
printf("AIN3 value = %.3f\n",dblVoltage);
//Set DAC0 to 3.1 volts.
/
//
eDAC(lngHandl
//Read state of FIO2.
//eDI (Handle, Channel, *State)
//
eDI(lngHandle, 2, &lngState);
printf("FIO2 state = %.0f\n",lngState);
/
/Set FIO3 to output-high.
//eDO (Handle, Channel, State)
//
e
//Enable and configure
Fill the arrays wit
//
alngEnableTimers = {1,1}; //Enable Timer0-Timer1
alngTimerModes = {LJ_tmPWM8,LJ_tmRISINGEDGES32}; //Set timer modes
blTimerValues = {16384,0}; //Set PWM8 duty-cycle to 75%.
ad
alngEnableCounters = {1,0}; //Enable Counter0
//
/eTCConfig (Handle, *aEnableTimers, *aEnableCounters, TCPinOffset,
/
/
// *aTimerValues, Reserved1, Reserved2);
//
eTCConfig(lngHandle, alngEnableTimers, alngEnableCounters, 0, LJ_tc48MHZ, 0,
alngTimerModes, adblTimerValues, 0, 0);
//Read a set the input timer (Tim
//the va duty-cycle) of the output tim
//Fill t rays with the desired val
alngReadTimers = {0,1}; //Read Timer1
alngUpdateResetTimers = {1,1}; //Update Timer0 and
alngReadCounters = {1,0}; //Read Counter0
ngResetCou ters = {1,0}; //Reset Counter0
al
adblTimerValues = {32768,0}; //Change Timer0 duty-cycle to 50%
//
//eTCValues (Handle, *aReadTimers, *aUpdateResetTimers, *aReadCounters,
// *aResetCounters, *aTimerValues, *aCounterValues, Reserved1,
/
//
eTCValues(lngHandle, alngReadTimers, alngUpdateResetTimers, alngReadCounters,
alngResetCounters, adblTimerValues, adblCounterValues, 0, 0);
printf("Timer1 value = %.0f\n",adblTimerValues[1]);
printf("Counter0 value = %.0f\n",adblCounterValues[0]);
4.3.10 Miscellaneous
The U3 has a buzzer that can be used to make noise. The buzzer has a resonant frequency of
about 4 kHz where it is the l
determined by toggling the signal ev
IOType is used to control the buzze
73