Andrei IRL
Senior Member
Hi again.
I want to use a strain gauge as an input device.
When a certain amount of force is applied a relay will actuate.
here is the problem
for some users i need to monitor PULL force which will give me increased READADC reading and based on that i can trigger rely when its larger then the preset value,
for other users i need to monitor PUSH force which will give me decreased READADC reading and based on that i can trigger relay when its smaller then the preset value.
The problem is, i need to be able to preset which program to run as one will have if< statement and the other will have if> statement. Can not run both statements at the same time as only need the relay to trigger for one of these conditions.,
Prior to changing the design to analog input, hence the need for READADC, i was working with digital input for this same function.
I had a small routine running up on program start that if one of the two buttons was pressed changed my variable to 0 or a 1 and that determined the direction of the force applied that the proximity sensor would use.
Now with strain gauge i want to have the same functionality.
I am maxed out on the inputs and outputs on my 08m2 chip so i can not put a selector switch to be used if that was possible.
Here is the initial code that i started working on (thanks to hippy for some help):
So the code above will set the largest or the smallest value read by READADC depending on which one of the two buttons was held pressed during program start up.
So then dependin on that i also would like to have the
to change from that to
depending on which one of the routines was ran before the main routine.
So the pull and push_1 routines are only possible to run upon initial power on.
I will also need to set a timer within pull and push_1 routines so they are running for about 30 seconds if activated.
I am not sure if the above is making a lot of sense to ye guys but will appriciate any help ye might provide.
Failing that i will have to switch to a larger chip and use a selector switch which will determine the routine to be ran, not sure if this is possible either at the moment.
I want to use a strain gauge as an input device.
When a certain amount of force is applied a relay will actuate.
here is the problem
for some users i need to monitor PULL force which will give me increased READADC reading and based on that i can trigger rely when its larger then the preset value,
for other users i need to monitor PUSH force which will give me decreased READADC reading and based on that i can trigger relay when its smaller then the preset value.
The problem is, i need to be able to preset which program to run as one will have if< statement and the other will have if> statement. Can not run both statements at the same time as only need the relay to trigger for one of these conditions.,
Prior to changing the design to analog input, hence the need for READADC, i was working with digital input for this same function.
I had a small routine running up on program start that if one of the two buttons was pressed changed my variable to 0 or a 1 and that determined the direction of the force applied that the proximity sensor would use.
Now with strain gauge i want to have the same functionality.
I am maxed out on the inputs and outputs on my 08m2 chip so i can not put a selector switch to be used if that was possible.
Here is the initial code that i started working on (thanks to hippy for some help):
Code:
symbol sens=b9
read 1,sens
if pin5=1 then pull
if pin3=1 then push_1
pull:
readadc 4,b8
if b8>sens then
let sens = b8
end if
write 1,sens
goto main
push_1:
readadc 4,b8
if b8<sens then
let sens = b8
end if
write 1,sens
goto main
main: high greenled
readadc 4,b7
if b7>sens then fire
goto main
So then dependin on that i also would like to have the
Code:
if b7>sens then fire
Code:
if b7<sens then fire
So the pull and push_1 routines are only possible to run upon initial power on.
I will also need to set a timer within pull and push_1 routines so they are running for about 30 seconds if activated.
I am not sure if the above is making a lot of sense to ye guys but will appriciate any help ye might provide.
Failing that i will have to switch to a larger chip and use a selector switch which will determine the routine to be ran, not sure if this is possible either at the moment.