Programming Examples
The following example shows how to output data in BASIC. The example
is in BASIC but translates readily into other programming languages.
Since the DACs have 12-bit resolution, data D should be in the range 0 to
4095 decimal. First, split the data into the two bytes DL% (low) and DH%
(high), as follows:
05 DH% = INT(D/16)
10 DL% = D - 16*DH%
20 DL% = 16* DL%
30
Next write the data to the DAC. The example uses DAC 0 with a base
address of 300h.
40 OUT &H300, DL%
50 OUT &H301, DH%
An assembly language routine is even simpler. Assume AX contains the
data and DX has the base address. Use the following statements to write
to DAC 0:
MOV CL,4
SAL AX,CL
OUT DX,AX
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
'Generate high byte
'Derive remainder in low byte
'Shift low nibble four places
' left
'Low byte
'High byte and load
;Set up for four left shifts
;Left justify data
'Write to DAC 0
6-3