Biomedical Engineering Reference
In-Depth Information
As conversion takes place, data are obtained in serial format on each falling-edge tran-
sition of SCLK after the third clock pulse. Since there are 12 bits, a minimum of 14 falling-
edge pulses are required to shift out the A/D result. Bits 0 and 1 of the LPT 8-bit output
port (hex address 378 for LPT1:) are toggled by software to implement the control portion
of the A/D's serial protocol. Bit 0 of the printer status port register (hex address 379 for
LPT1:) is used to receive the serial data from the A/D.
A 3-bit parallel interface using bits 4, 5, and 6 of the LPT 8-bit output port (hex address
378 for LPT1:) controls the analog input multiplexer (IC2) that selects which one of the
eight analog inputs is presented to the input of the A/D converter. Power for the A/D con-
verter, the 2.5-V reference, and the multiplexer is supplied directly from the lines con-
trolled by bits 2 and 3 of the parallel printer port.
The following VisualBasic code module (DECLARATIONS.BAS) shows the exact
location of the control bits for the universal sensor interface.
' This module contains the general declarations required
' to operate the Universal Sensor Interface
'
'
'
' Declare DLL to enable I/O through the printer port
' --------------------------------------------------
'
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Byte
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Byte)
'
' Printer port locations
' ----------------------
Global Const prinop1 &H378
' Printer Output Port for LPT1
Global Const prinstat1 &H379
' Printer Status Port for LPT1
Global Const princont1 &H37A
' Printer Control Port for LPT1
Global Const prinop2 &H278
' Printer Output Port for LPT2
Global Const prinstat2 &H279
' Printer Status Port for LPT2
Global Const princont2 &H27A
' Printer Control Port for LPT2
Global Const prinop3 &H3BC
' Printer Output Port for LPT3
Global Const prinstat3 &H3BD
' Printer Status Port for LPT3
Global Const princont3 &H3BE
' Printer Control Port for LPT3
'
' Define control pin locations for LPT:Analog! model 8c-I/O
' ---------------------------------------------------------
Global Const notdaclk 1, notdacs 2, dadat 4
' notdaclk is the D/A serial clock line (active low)
' notdacs is the D/A chip select line (active low)
' dadat is the D/A serial data input line
Global Const power 12, notcs 1, sclk 2, muxd0 16, muxd1 32, muxd2 64
' power
are the two D/A power supply lines
' notcs
is the A/D chip select line (active low)
' sclk
is the A/D serial clock line
' muxd0
is the A/D input multiplexer data line 0
' muxd1
is the A/D input multiplexer data line 1
' muxd2
is the A/D input multiplexer data line 2
Search WWH ::




Custom Search