![background image](http://html1.mh-extra.com/html/keithley/dda-06/dda-06_user-manual_3957614030.webp)
6-3
Programming Examples
The examples in this section are in BASIC but translate readily into other
programming languages.
Example 1: Write to Any DAC
Let D = data in the range of 0 to 4095 (12 bits).
Let BASE = the base address of the board as a decimal number.
05 BASE = 768
’Select the base address
10 XH% = INT(D/256)
’Put the 4 MSBs in XH%
20 XL% = D - XH% * 256
’Put the 8 LSBs in XL%
30 OUT (BASE +0), XL%
’Write the 8 LSBs to the low
40
’byte of DAC 0
50 OUT (BASE +1), XH%
’Write the MSBs to the high
60
’byte of DAC 0
For a normal update, the DAC is automatically updated after the MSB
write performed on line 50. For a simultaneous update, add the following
when all the DACs are loaded:
X% = INP(BASE)
’X% is a dummy variable
To write to a different DAC, change lines 30 and 50 to write to the
appropriate registers. The following example shows the changes required
to write to DAC 4.
30 OUT (BASE +8), XL%
’Write the 8 LSBs to the low
40
’byte of DAC 4
50 OUT (BASE +9), XH%
’Write the MSBs to the high
60
’byte of DAC 4
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com