Shop OBEX P1 Docs P2 Docs Learn Events
How to clear RCTime data in Debug — Parallax Forums

How to clear RCTime data in Debug

NWUpgradesNWUpgrades Posts: 292
edited 2009-10-05 04:12 in BASIC Stamp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-05 02:28
    It's not the cause of your problem, but why do you have a DO / LOOP? It doesn't do anything.

    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.
  • NWUpgradesNWUpgrades Posts: 292
    edited 2009-10-05 03:36
    Thanks for the help. Without the DO/LOOP, when the sensor was released the sound was still emitting. I will try it the way you said to see if that fixes it. Any advice on using StampDAQ? I am unable to get the readings to come up on the charts.
  • NWUpgradesNWUpgrades Posts: 292
    edited 2009-10-05 04:12
    That worked. Thanks. Just one other question. Should the counter not reset back to 0 when there is no force on the sensor? That actually just occurred to me.
Sign In or Register to comment.