MSB% = D \ 256 LSB% = D - (256 * MSB%)
To output this to DAC #1, for example, you would do an OUT A+4, LSB%
followed by an OUT A+5, MSB%. Note that the order in which the bytes is
OUTput is significant; you must output the LSB first. The output voltage
changes as soon as the data are OUTput, it is not necessary to issue a "begin
conversion" command as is the case with analog-to-digital converters.
2. Write a program which prompts the user to select DAC 1 or 2 and then enter
an integer between 0 and 4095 and outputs that number to the specified DAC.
3. Connect a digital voltmeter to the output of DAC #1 (pin 13 on CN2). Use
your program to OUTput numbers from 0 to 4095 into that DAC and note the effect
on the output voltage. What is the functional relationship between the integer
data and the voltage? Modify your program so that it prompts the user for a
voltage (between 0 and 5 volts) and then sets the output of the DAC as close as
possible to that voltage. Check your program for accuracy vs the digital volt
meter for several voltages in the 0 to 5 volt range.
4. Write a program that uses the internal TIMER functions and the DAC to
generate a linear ramp voltage at a user-specified rate (in volts/sec) between
any specified starting and ending voltage within the 0 - 5 volt range of the
DAC. (The program should be capable of generating ramps from lower to higher
voltages and from higher to lower voltages).
Lab report: Submit your program on disk for #4 only.