The following BASIC language subroutine is used to retrieve a value from the MAX187 ADC when the appropriate circuit is attached to the parallel port base addressed at 378h. The value returned in the 16 bit integer Accum% is the raw value from the ADC. It is equal to the millivolt value sensed by the ADC. This is not a complete program and is merely intended to provide this functionality to those who would like to write their own data collection program. The program is quite repetitive and could easily by shortened using looping structures, however, to do this would slow the routine down to some degree, and thus the linear approach was used.

Sub DVR378max187(Accum%)

On Error Resume Next

Dim Q%

Accum% = 0

Out 888, 1

Out 888, 0

Q% = vbInp(889)

Out 888, 2

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = 2048

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 1024

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 512

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 256

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 128

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 64

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 32

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 16

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 8

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 4

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 2

Out 888, 0

Out 888, 2

If (Inp(889) And 32) > 0 Then Accum% = Accum% + 1

Out 888, 2

Out 888, 0

Out 888, 2

Out 888, 0

Out 888, 1

End Sub

HOME | BEGINNERS | JUPITER | SOLAR | PULSARS | PROJECTS | FAQ | BOOKS | SOFTWARE | SUPPORT | ORDERING | LINKS