Where is the first debug command in this code?
Tyler Meek
Posts: 21
Here is the first part of the example code supplied by Parallax for the SHT11 (temp/humidity)
tF VAR Word ' temp - Fahrenheit
soRH VAR Word ' humidity counts
rhLin VAR Word ' humidity; linearized
rhTrue VAR Word ' humidity; compensated
status VAR Byte ' status byte
'
' EEPROM Data
'
'
' Initialization
'
Initialize:
GOSUB SHT_Connection_Reset ' reset device connection
PAUSE 250 ' let DEBUG window open
DEBUG CLS,
"SHT11 Sensor Demo", CR,
"
", CR
'
' Program Code
'
Main:
DO
GOSUB SHT_Measure_Temp
DEBUG CRSRXY, 0, 3,
"soT...... ", DEC soT, CR,
"tC....... ", DEC (tC / 10), ".", DEC1 tC, DegSym, " ", CR,
"tF....... ", DEC (tF / 10), ".", DEC1 tF, DegSym, " "
GOSUB SHT_Measure_Humidity
DEBUG CRSRXY, 0, 7,
"soRH..... ", DEC soRH, CR,
"rhLin.... ", DEC (rhLin / 10), ".", DEC1 rhLin, "% ", CR,
"rhTrue... ", DEC (rhTrue / 10), ".", DEC1 rhTrue, "% "
PAUSE 1000
LOOP
END
'
' Subroutines
'
' connection reset: 9 clock cyles with ShtData high, then start sequence
'
SHT_Connection_Reset:
SHIFTOUT ShtData, Clock, LSBFirst, [$FFF\9]
' generates SHT11 "start" sequence
' _____ _____
' ShtData |_______|
' ___ ___
' Clock ___| |___| |___
'
SHT_Start:
INPUT ShtData ' let pull-up take high
LOW Clock
HIGH Clock
LOW ShtData
LOW Clock
HIGH Clock
INPUT ShtData
LOW Clock
RETURN
After Initialization there is the GOSUB command and then the PAUSE 250 'let DEBUG window open command/explanation
Where is the command to open the debug window in the first place?
tF VAR Word ' temp - Fahrenheit
soRH VAR Word ' humidity counts
rhLin VAR Word ' humidity; linearized
rhTrue VAR Word ' humidity; compensated
status VAR Byte ' status byte
'
' EEPROM Data
'
'
' Initialization
'
Initialize:
GOSUB SHT_Connection_Reset ' reset device connection
PAUSE 250 ' let DEBUG window open
DEBUG CLS,
"SHT11 Sensor Demo", CR,
"
", CR
'
' Program Code
'
Main:
DO
GOSUB SHT_Measure_Temp
DEBUG CRSRXY, 0, 3,
"soT...... ", DEC soT, CR,
"tC....... ", DEC (tC / 10), ".", DEC1 tC, DegSym, " ", CR,
"tF....... ", DEC (tF / 10), ".", DEC1 tF, DegSym, " "
GOSUB SHT_Measure_Humidity
DEBUG CRSRXY, 0, 7,
"soRH..... ", DEC soRH, CR,
"rhLin.... ", DEC (rhLin / 10), ".", DEC1 rhLin, "% ", CR,
"rhTrue... ", DEC (rhTrue / 10), ".", DEC1 rhTrue, "% "
PAUSE 1000
LOOP
END
'
' Subroutines
'
' connection reset: 9 clock cyles with ShtData high, then start sequence
'
SHT_Connection_Reset:
SHIFTOUT ShtData, Clock, LSBFirst, [$FFF\9]
' generates SHT11 "start" sequence
' _____ _____
' ShtData |_______|
' ___ ___
' Clock ___| |___| |___
'
SHT_Start:
INPUT ShtData ' let pull-up take high
LOW Clock
HIGH Clock
LOW ShtData
LOW Clock
HIGH Clock
INPUT ShtData
LOW Clock
RETURN
After Initialization there is the GOSUB command and then the PAUSE 250 'let DEBUG window open command/explanation
Where is the command to open the debug window in the first place?
Comments
Make sure you have your declarations for your chip as in:
will not display. It needs to be:
The "Pause 250" is giving the program 250 ms (1/4 second) to give the "GOSUB SHT_Connection_Reset" routine time to return from the the reset. Otherwise it may miss some data.