I think you should find a way to give a value to var ch1. As it is it will get a random number on startup.
Ioannis
I think you should find a way to give a value to var ch1. As it is it will get a random number on startup.
Ioannis
thanks for the reply i have just seen my mistake thanks really it shound look like this then?
'servo control prog
'set variables
ch1 var byte
ch2 var byte
s1 = 150
start:
pulsin portb,1,Ch1
pulsin portb,2,Ch2
if ch1 < s1 then output1
if ch1 > s1 then output1
if ch1 = s1 then output2
output1:
pulsout portb.3,ch1
pause 18
goto start
output2:
pulsout portb.3,ch2
pause 18
goto start
end
Secound question how do i subsitue ch2 for a pot instead of a pwm signal would it look like this
potportb.2,200,var
would this give me the correct value to output to a servo?
You may have to give us more details of what you are trying to accomplish. No one would "play" with you and build command by command your code or what evere.
Give more input. What is you input signal. Is it Pulse? Is it from a PC? Is it from a pot?
You are not clear. I said that your variable would need a value. Pulsin would give a value to ch1 but is it what you really want to do?
Ioannis
Hi there thanks for your help i have anouther thread running in this same fourm its called How would i write this in pic basic pro (Servo controller)
thanks
Bookmarks