You need to provide more information about what you're doing. At the very least, provide your source code and a description of how you have things connected.
If you're referring to the use of RCTIME to measure the resistance of the sensor where RCTIME provides a time value, you'll have to calibrate your system using test weights. The BASIC Stamp Syntax and Reference Manual discusses the use of RCTIME to measure resistance and shows how the resistance can be calculated from the capacitance used and the time measured. Look at this article from the manufacturer's FAQs. In addition to using curve fitting to get an equation for force vs. resistance, you can use the Stamp's LOOKDOWN statement.
time VAR Word
sensorPin CON 15
DO
HIGH sensorPin
PAUSE 100
RCTIME sensorPin,1,time
DEBUG HOME, "time = ", DEC5 time, CR
IF time>10 THEN
HIGH 14
PAUSE 500
ELSE
LOW 14
PAUSE 500
ENDIF
LOOP
The program objective is detect the force applied on a flexiforce sensor, if the force applied is greater than the number assigned then power on a LED, I need to convert the RCTIME into force.
This same question came up here on this forum about a week ago, too, how to convert the RCTIME value to force, from the flexiforce sensor. Basically, force is inversely proportional to resistance.
Comments
If you're referring to the use of RCTIME to measure the resistance of the sensor where RCTIME provides a time value, you'll have to calibrate your system using test weights. The BASIC Stamp Syntax and Reference Manual discusses the use of RCTIME to measure resistance and shows how the resistance can be calculated from the capacitance used and the time measured. Look at this article from the manufacturer's FAQs. In addition to using curve fitting to get an equation for force vs. resistance, you can use the Stamp's LOOKDOWN statement.
IF rawforce >=50000 THEN FREQOUT 4, 1500, 1000 FREQOUT 4, 1500, 1500 FREQOUT 4, 1500, 2000 FOR counter = 1 TO 300 PULSOUT 13, 2030 PULSOUT 12, 1627 PULSOUT 14,1650 PAUSE 20 DEBUG CLS NEXT ENDIF
Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
sensorPin CON 15
DO
HIGH sensorPin
PAUSE 100
RCTIME sensorPin,1,time
DEBUG HOME, "time = ", DEC5 time, CR
IF time>10 THEN
HIGH 14
PAUSE 500
ELSE
LOW 14
PAUSE 500
ENDIF
LOOP
The program objective is detect the force applied on a flexiforce sensor, if the force applied is greater than the number assigned then power on a LED, I need to convert the RCTIME into force.
' {$PBASIC 2.5} ' {$PORT COM1} ' -----[ Declarations ]---------------------------------------------------- counter VAR Word rawForce VAR Word ' Stores raw output sensorPin PIN 14 ' Flexiforce sensor circuit duration VAR Word ' -----[ 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 IF rawforce >=50000 THEN FREQOUT 4, 1500, 1000 FREQOUT 4, 1500, 1500 FREQOUT 4, 1500, 2000 FOR counter = 1 TO 300 PULSOUT 13, 2030 PULSOUT 12, 1627 PULSOUT 14,1650 PAUSE 20 DEBUG CLS NEXT ENDIF GOTO Measure