36
Rabbit 2000 Development Kit
The output value is set using the following function.
sets the state of an analog output channel.
jrioInit
must be called first.
channel
is the output channel number (0 or 1 on the BL1810).
value
is an integer from 0–1024 that corresponds to an output voltage as shown in Table 2.
NOTE:
See the sample program
JRIOTEST.C
for examples of using the
anaOut
func-
tion.
Effect of Interrupts on Analog I/O
The stability of the voltage output (and hence the voltage input determination as well)
depends on the ability of the driver to respond quickly to interrupt requests. Dynamic C
debugging, use of the
printf
function, or any serial communications can disrupt the
pulse-width modulation utilized by the driver and cause fluctuations in the voltage out-
puts. Avoid using serial communications or
printf
statements during portions of your
program where the voltage must remain steady. Also be aware that debugging and running
Dynamic C in polling mode will cause fluctuations. Finally, be certain to disable the PWM
drivers by setting the output values to 0 or 1024 when you are done using them to free up
the CPU.
Calibration of Values to Voltages
The analog output channels on the BL1810 can be more accurately calibrated for each
individual BL1810 in the following manner (calibration of DA0 is assumed in this exam-
ple, calibration of DA1 would proceed similarly):
•
Set desired channel output to
PWM_MIN
.
•
Measure voltage
V
min
on DA0.
•
Set desired channel output to
PWM_MAX0
.
•
Measure voltage
V
max
on DA0.
•
A linear relation between input value and voltage can now be calculated:
Table 2. Typical Analog Output Voltages Corresponding
to Values in anaOut Function
Channel
0
PWM_MIN
PWM_MAX
1024
DA0
0.08 V
0.08 V
2.875 V
3.4 V
DA1
0.004 V
0.63 V
3.6 V
3.6 V
void anaOut(int channel, int value);
Downloaded from
Elcodis.com
electronic components distributor
Summary of Contents for 2000
Page 20: ...16 Rabbit 2000 Development Kit Downloaded from Elcodis com electronic components distributor...
Page 34: ...30 Rabbit 2000 Development Kit Downloaded from Elcodis com electronic components distributor...
Page 50: ...46 Rabbit 2000 Development Kit Downloaded from Elcodis com electronic components distributor...
Page 52: ...48 Rabbit 2000 Development Kit Downloaded from Elcodis com electronic components distributor...
Page 54: ...Downloaded from Elcodis com electronic components distributor...