PulsePort - weird problem._Campbellsci论坛问答

Hi all,

I am having a problem with the PulsePort command (long winded post ahead)

PulsePort - weird problem._Campbellsci论坛问答

I use C4 and C7 to control two servo motors using pulse width modulation.

Originally I used the PWM command, ie:


Sub SetPWM1(dutyc)
PWM (dutyc,4,20,mSec)
EndSub

Sub SetPWM2(dutyc)
PWM (dutyc,7,20,mSec)
EndSub

'Operate wipers
Call setpwm1(0.05)
Delay(1,1000,mSec)
Call setpwm1(0.10)
Delay(1,1000,mSec)
Call setpwm1(0.05)
Delay(1,1000,mSec)
Call setpwm1(0.10)
Delay(1,1000,mSec)
Call setpwm1(0)
Call setpwm2(0.10)
Delay(1,1000,mSec)
Call setpwm2(0.05)
Delay(1,1000,mSec)
Call setpwm2(0.10)
Delay(1,1000,mSec)
Call setpwm2(0.05)
Delay(1,1000,mSec)
Call setpwm2(0)

However the problem with this was that once PWM is run the CR1000 always draws 8mA of power.

Currently we do the same thing with the PulsePort command:


SubScan (20,mSec,50)
PulsePort (4,1000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (4,2000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (4,1000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (4,2000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (7,2000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (7,1000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (7,2000)
NextSubScan
SubScan (20,mSec,50)
PulsePort (7,1000)
NextSubScan

This works fine. However some instruments have been coming back with the servo on port C7 no longer working after being in the field a while.

Running the old code (using PWM command) the servo on C7 works. Switching to the new code it doesn't.

BUT - if I reload the operating system onto the CR1000, effectively clearing everything, then new code works again. So it is not a hardware issue.

Any ideas? Is there anyway the pulse port command could get corrupted? Some flag in the OS that once set no longer lets me output to that port?

Thanks
Ross

* Last updated by: geometrikal on 5/4/2010 @ 12:46 AM *

分享到:

原文链接:,转发请注明来源!
「PulsePort - weird problem._Campbellsci论坛问答」评论列表

发表评论