pulsing output
Gertsen
Posts: 2
A have an 'Accustar II DAS 20' Tilt Sensor and i am trying to use it for platform leveling.· http://www.meas-spec.com/myMSI/sensors/pdf/tilt/accustar-ii-das-20.pdf
When the sensor is at 0 degrees:
···· Voltage = 3V
···· Duty Cycle = 50%
When the sensor is at +20 degrees:
···· Voltage = 4.2V
···· Duty Cycle = 70%
When the sensor is at -20 degrees:
···· Voltage = 2.8
···· Duty Cycle = 30%
Duty cycle is 't2/(t1+t2)'· t1 and t2 vary from .2 to .7 msec
I am using the PULSIN command to measure the PWM and convert it into a variable the stamp can manipulate.
I have PIN 1 as input and PINS 5 and 10 as outputs
When the sensor is tilted from zero to +20 degrees i want PIN 5 high
When the sensor is tilted from zero to -20 degrees i want PIN 10 high
and when the sensor is level i want PIN 5 and 10 low.
Here's my problem:
Pin 10 is continually pulsing on and off when sensor is from 0 to +20 degrees(which is bad),·and is totally on·with a negitive tilt (which is Good) .
It should be completly off from 0 to +20 degrees
My pin 5 on and off works just fine.
Here is my Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
INPUT 1
OUTPUT 5
OUTPUT 10
pulsehigh VAR Word
LOW 5
LOW 10
pulse:
PULSIN IN1, 1, pulsehigh··· 'making the dutycylce into varialbe
IF pulsehigh > 2600 THEN·· 'turn on pin 5 relay if sensor is tilted forward
· HIGH 5
· LOW 10
ELSEIF pulsehigh > 2000 AND pulsehigh < 2600· THEN 'turn off pin 5 and 10 if sensor is level
· LOW 5
· LOW 10
ELSEIF pulsehigh < 2000 THEN·· 'turn on pin 10 if sensor is tilted back
· HIGH 10
· LOW·5
ENDIF
GOTO pulse
END
When the sensor is at 0 degrees:
···· Voltage = 3V
···· Duty Cycle = 50%
When the sensor is at +20 degrees:
···· Voltage = 4.2V
···· Duty Cycle = 70%
When the sensor is at -20 degrees:
···· Voltage = 2.8
···· Duty Cycle = 30%
Duty cycle is 't2/(t1+t2)'· t1 and t2 vary from .2 to .7 msec
I am using the PULSIN command to measure the PWM and convert it into a variable the stamp can manipulate.
I have PIN 1 as input and PINS 5 and 10 as outputs
When the sensor is tilted from zero to +20 degrees i want PIN 5 high
When the sensor is tilted from zero to -20 degrees i want PIN 10 high
and when the sensor is level i want PIN 5 and 10 low.
Here's my problem:
Pin 10 is continually pulsing on and off when sensor is from 0 to +20 degrees(which is bad),·and is totally on·with a negitive tilt (which is Good) .
It should be completly off from 0 to +20 degrees
My pin 5 on and off works just fine.
Here is my Code:
' {$STAMP BS2}
' {$PBASIC 2.5}
INPUT 1
OUTPUT 5
OUTPUT 10
pulsehigh VAR Word
LOW 5
LOW 10
pulse:
PULSIN IN1, 1, pulsehigh··· 'making the dutycylce into varialbe
IF pulsehigh > 2600 THEN·· 'turn on pin 5 relay if sensor is tilted forward
· HIGH 5
· LOW 10
ELSEIF pulsehigh > 2000 AND pulsehigh < 2600· THEN 'turn off pin 5 and 10 if sensor is level
· LOW 5
· LOW 10
ELSEIF pulsehigh < 2000 THEN·· 'turn on pin 10 if sensor is tilted back
· HIGH 10
· LOW·5
ENDIF
GOTO pulse
END
Comments
It seems to be working now.