30064 Parallax Inc, 30064 Datasheet - Page 15

STAMP PLC

30064

Manufacturer Part Number
30064
Description
STAMP PLC
Manufacturer
Parallax Inc
Datasheet

Specifications of 30064

Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
Module/board Type
-
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
Other names
Q2172565
' -- uses shadow register "digOuts" (1 = output on)
'
' 21-DEC-03 Update
' ----------------
' map bits in digOuts to physical connector
Update_DigOuts:
' This routine can be used to refresh shadow register "digOuts" after
' direct manipulation of individual output bits.
Read_DigOuts:
' Reads analog input channel (0 - 5 vdc)
' -- put channel (0 - 3) in "chan"
' -- pass mode (0 - 4) in "mode")
' -- raw value returned in "adcRaw"
' -- "adcRaw" converted to signed "mVolts"
Read_ADC:
Parallax, Inc. • Stamp PLC (#30064) • Version 1.8 • 12/29/2003
DOuts.BIT0 = ~digOuts.BIT6
DOuts.BIT1 = ~digOuts.BIT7
DOuts.BIT2 = ~digOuts.BIT4
DOuts.BIT3 = ~digOuts.BIT5
DOuts.BIT4 = ~digOuts.BIT2
DOuts.BIT5 = ~digOuts.BIT3
DOuts.BIT6 = ~digOuts.BIT0
DOuts.BIT7 = ~digOuts.BIT1
RETURN
dOut1 = ~DOuts.BIT6
dOut2 = ~DOuts.BIT7
dOut3 = ~DOuts.BIT4
dOut4 = ~DOuts.BIT5
dOut5 = ~DOuts.BIT2
dOut6 = ~DOuts.BIT3
dOut7 = ~DOuts.BIT0
dOut8 = ~DOuts.BIT1
RETURN
READ AdcCfg + (mode * 4 + chan), config
LOW AdcCS
SHIFTOUT AdcDo, Clock, MSBFIRST, [config]
HIGH AdcCS
adcRaw = 0
LOW AdcCS
SHIFTIN AdcDi, Clock, MSBPRE, [adcRaw\12]
HIGH AdcCS
' adjust ADC count for input voltage divider
'
adcRaw = adcRaw + (adcRaw ** $D6C) MAX 4095
' millivolts conversion
' -- returns signed value in bipolar modes
' -- uses raw (12-bit) value
'
SELECT mode
CASE AdcUP5
mVolts = adcRaw + (adcRaw ** $3880)
' map bits from Stamp port
' get config
' select MAX1270
' send config byte
' deselect MAX1270
' read channel value
' x ~1.05243
' x 1.2207
Page
15

Related parts for 30064