122-28176 Parallax Inc, 122-28176 Datasheet - Page 199

GUIDE STUDENT PROCESS CONTROL

122-28176

Manufacturer Part Number
122-28176
Description
GUIDE STUDENT PROCESS CONTROL
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-28176

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
LOOP
' -----[ Subroutines ]-----------------------------------------------------
ReadSP:
SetADC:
ReadADC:
CalcTemp:
UpdateSP:
PlotPoint:
GOSUB PlotPoint
PAUSE 100
DEBUG CR,"!READ [(txtADCoffset),*,10]",CR ' obtain offset volt. in tenths
DEBUGIN DEC V_Offset
PAUSE 50
DEBUG "!READ [(txtADCspan),*,10]",CR
DEBUGIN DEC V_Span
PAUSE 50
RETURN
PWM ADC_Vminus, V_Offset * 255/50,100
PWM ADC_Vref, V_Span * 255/50,100
RETURN
LOW ADC_CS
SHIFTIN ADC_Dout, ADC_Clk, MSBPOST,[ADC_ByteValue\9] ' Clock in ADC data
HIGH ADC_CS
RETURN
TempF = (V_Span * 1000)/255 * ADC_ByteValue + (V_Offset * 1000)
RETURN
DEBUG "!O txtByteBin = ", BIN8 ADC_ByteValue,CR, ' Update w/ binary ADC val
DEBUG "!O txtTemp = [", DEC TempF,",/,100]",CR
RETURN
DEBUG "!FCIR (txtByte),(txtTemp),0.3A,(WHITE)",CR
PAUSE 100
DEBUG "!FCIR ,,,(BLUE)",CR
RETURN
Load StampPlot macro sic_pc_adc_span_offset.spm.
Verify that "ADC Span" is set to 5 and "ADC Offset" is set to 0 in StampPlot.
Connect and plot. A small blinking dot will appear on the screen, marking the
temperature.
"!O txtByte = ", DEC ADC_ByteValue,CR
' y = mx + b
' where y=temp,
' m = (change in output)/(change in input) = voltage Span/255
' x = ADC value read, b = offset, y = temperature in hundredths
' temperature = (Span/255)Byte + Offset
' Read ADC 0831
' Enable chip
' Disable ADC
' obtain span voltage in tenths
' Apply PWM to set offset volt.
' Apply PWM to set span voltage
' Update w/ decimal ADC val
' Update w/ temperature/100
' Plot white circle at
'
' Plot again in blue
byte, Temp as X,Y

Related parts for 122-28176