Hi All
Have done the following code to auto select which output to use to maintain
a preset value against a sensor reading
The problem I am having is that I want it to use pins D.7 too D.4 only
The code moves up and down the 4 pins ok until it reaches D.4 or D.7
Has any one any sugestions as how to cap it to use only these 4 pins so if it is already at pin D.4 or D.7 then just return
to main leaving D.7 or D.4 on
rgards john
Have done the following code to auto select which output to use to maintain
a preset value against a sensor reading
The problem I am having is that I want it to use pins D.7 too D.4 only
The code moves up and down the 4 pins ok until it reaches D.4 or D.7
Has any one any sugestions as how to cap it to use only these 4 pins so if it is already at pin D.4 or D.7 then just return
to main leaving D.7 or D.4 on
Code:
'Attempt to auto select which output pin to use
dirsD = %11110000
b3=25
outpinsD = %01000000
pause 3000
main:
do
readadc A.1,b2
if b2<>b3 then gosub auto
pause 3000
loop
auto:
if b2<b3 then
outpinsD = outpinsD>>1
elseif b2>b3 then
outpinsD=outpinsD<<1
endif
return