| ??? 07/06/02 16:22 Read: times |
#25374 - problem on useing PCA to control servo |
hi
i use system clock/4 as input of PCA 16 bit counter/Timer, form my understanding the clock frequency is not important it just control how fast of the servo motor turns. please correct me if i'm wrong. my gold is to make the servo turn little by little so at some point i can generate a interupt to stop it. i have set PCA0MD=ox42, which is 8-bit PWM mode. duty cycle=(256-PCA0CPHn)/256x100; so i try 10%,20%...90% which PCA0CPHn=230.4,204.8...25.6.(25 gap in between) PWN=230; PCA0CPL0 = 256; // initialize PCA PWM value for (;;){ //infinity loop PCA0CPH0 = PWM; wait(1000); //function of delay if (PWM<=10) //i pick 10 i think any #<25 //will work. PWM+=25; else PWM -=25; } since the servo recive diff. duty cycle will go to diff. position. so i intend to send 10% 20%...90% and then 90%,80%..10%. to make the servo back and forth for ever. but it dosn't,instead of that, it go back and forth about 5 degrees in one position. please help thanks fan ng PS. if i don't use loop, just send one value to PCA0CPHn, it will go all the way to one end or other. eg. set PWM=10,12 or some small value it will go all the way to 180, set PWM=64 or 128 or some large value it will go to 0. why i send diff. value of PWM it will go to the same position. |
| Topic | Author | Date |
| problem on useing PCA to control servo | 01/01/70 00:00 | |
| RE: problem on useing PCA to control servo | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
| RE: problem on useing PCA to control ser | 01/01/70 00:00 | |
RE: problem on useing PCA to control ser | 01/01/70 00:00 |



