How to clear RCTime data in Debug
NWUpgrades
Posts: 292
Can anyone help with this issue. I modified the Flexisensor program to send a pulse to a speaker if the RCTime measurement exceeds 50k. The program does this and then when pressure is released it shuts off. However, the data in the Debug screen never goes back to 0. How do I make this program go back to 0 in the Debug screen? I am using a BS2sx chip. Also, can anyone give me any pointers on using the StampDAQ software? I am having trouble getting the data in to the spreadsheet.
' Flexiforce Simple.bs2
' Displays R/C Discharge Time in BASIC Stamp DEBUG Window
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
RC············· PIN···· 15
rawForce······· VAR···· Word··········· ' Stores raw output
sensorPin······ CON···· 15············· ' Flexiforce sensor circuit
'
[noparse][[/noparse] Main Routine ]
Measure:
· HIGH sensorPin······················· ' Discharge the capacitor
· PAUSE 2
· RCTIME sensorPin,1,rawForce·········· ' Measure RC charge time
· DEBUG HOME, "Flexiforce raw output = ", DEC rawForce,CR
· DO
· IF rawforce >=50000 THEN
· FREQOUT 4, 1500, 1000
· ENDIF
· GOTO Measure
· LOOP
' Flexiforce Simple.bs2
' Displays R/C Discharge Time in BASIC Stamp DEBUG Window
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
RC············· PIN···· 15
rawForce······· VAR···· Word··········· ' Stores raw output
sensorPin······ CON···· 15············· ' Flexiforce sensor circuit
'
[noparse][[/noparse] Main Routine ]
Measure:
· HIGH sensorPin······················· ' Discharge the capacitor
· PAUSE 2
· RCTIME sensorPin,1,rawForce·········· ' Measure RC charge time
· DEBUG HOME, "Flexiforce raw output = ", DEC rawForce,CR
· DO
· IF rawforce >=50000 THEN
· FREQOUT 4, 1500, 1000
· ENDIF
· GOTO Measure
· LOOP
Comments
You should define "sensorPin" using a PIN declaration. You don't need the declaration for RC. It isn't used anyhow. PIN defines labels that can be used both as a pin number and as a variable. The compiler uses context to decide.
HOME doesn't clear the debug screen, so you're seeing what was written before. Use CLS instead to move the cursor to the home position and clear the screen.