by using the config definitions you hasve indicated the config values work out to that
second issue i was telling was about the patch for delay2m subroutine-- and better to test its correctness -- perhaps all the delay patches for that matter
-- what i was trying to know is whether during the delay period any input to PIC is expected from the Servo ??
Sorry I mixed up the modified config value my bad...the delay subroutine values should be working fine...the delay after the BSF is to send pulse while the delay after the BCF is to make sure total delay will be 20mS before sending another pulse...during the delay no input should be expected...I think that's how it should work...
hey mvs sarma
So u think that is the problem? The TURN90 won't come out of the loop...
ok i put in DECFSZ to get it out from the loop and I tested it...but the result still the same...It stuck at 90 instead of go to 180 then back to 90 Do you think is other problem (power problem)? Or still got programming error?
Before this I already tested the code to move servo only to 90 and another code to move servo only to 180...Both codes are a success...
I tested your original code on a 16F876 and looked at the output on a scope. It is exactly as it is supposed to be. It outputs a 2mS pulse every 20mS for 4S and then switches to a 1.5mS pulse every 20mS. There is nothing wrong with your code. Can you get access to a scope?
Hey guys I think I have successfully got the servo to move properly, sort of; I set the TURN90 routine to change every 4 sec same as the TURN180 routine then I loop it back to the start to repeat everything...The servo changes its position every 4 secs just like what I wrote but the only thing is the position to which the servo moves to seem out of sync i.e. not 180 and 90 as I had wrote...How should I fix this?
You are right in your interpretation of the code. However, it shouldn't matter as the servo will see a 2mS pulse for 4 seconds and then will get stuck in the turn90 loop by which time it has completed the task.
Hey guys I think I have successfully got the servo to move properly, sort of; I set the TURN90 routine to change every 4 sec same as the TURN180 routine then I loop it back to the start to repeat everything...The servo changes its position every 4 secs just like what I wrote but the only thing is the position to which the servo moves to seem out of sync i.e. not 180 and 90 as I had wrote...How should I fix this?
Mike and mvs sarma, thanks alot for your help...I appreciate it
One thing I still don't understand...When I write the code to give the servo a 2mS pulse only, it moved to 180 degree position as written...but in the TURN180 code it won't turn to 180 just like the previous code...? The difference between the angles formed with the TURN180 code is 90 degrees but the position is not 180 degree and 90 degree as it should be...