Manual Number: 00650-134-4
Page 15
Chapter 7: Software
The AOBx/12 cards are straightforward to program. The following example is in BASIC, but for
languages such as C or Pascal the procedure is simplified by their support of two-byte output
operations:
To output an analog value with 12-bit resolution, a corresponding decimal number N between 0
and 4095 is calculated (2^12 = 4096).
N/4096 = V(out)/V(full scale)
Then the number is split between high and low bytes, as follows:
H% = INT (N / 256)
L% = N - (H% * 256)
Next the data are written to the selected analog output channel. (See the preceding I/O Address
Map.) In this example, we will assume analog output on channel zero (AO 0).
OUT (BASE + 0), L%
OUT (BASE + 1), H%
For simplicity, it was assumed that the simultaneous-update capability was not used.
Examples of this routine are found on the sample disk along with examples in other languages.
VisualBASIC
™
Utility Driver
Extensions to the VisualBASIC language are now provided on the diskette provided with your card.
The extensions are in a directory named VBACCES. These extensions are in the form of a .DLL,
a .GBL, and a VisualBASIC sample. Together these files allow you to access the port and main
memory space in a fashion similar to BASIC, QuickBASIC, Pascal, C/C
++
, Assembly, and most
other standard languages.
To use these files in a VisualBASIC program, you must create a .MAK file (File l New Project)
similar to the sample provided (or else, modify your existing project file) and include the .GBL file
(File | Add File). Once this has been done, VisualBASIC will be enhanced with the addition of the
following functions.
InPortb
Function:
Reads a byte from a hardware port. Due to limitations of VisualBASIC, the number
is returned in an integer.
Declaration:
function InPortb(byval
address as integer) as integer
Summary of Contents for AOB8/12
Page 1: ...Model AOB8 12 AOB16 12 Product Manual MANUAL NUMBER 00650 134 4C...
Page 3: ...Page iv This page intentionally left blank...
Page 7: ...Page viii This page intentionally left blank...
Page 9: ...Page x This page intentionally left blank...
Page 15: ...Manual Number 00650 134 4 Page 6 AOB8 12 AOB16 12 Manual Figure 3 1 Option Selection Map...
Page 21: ...Manual Number 00650 134 4 Page 12 AOB8 12 AOB16 12 Manual This page intentionally left blank...
Page 23: ...Manual Number 00650 134 4 Page 14 AOB8 12 AOB16 12 Manual This page intentionally left blank...
Page 27: ...Manual Number 00650 134 4 Page 18 AOB8 12 AOB16 12 Manual This page intentionally left blank...