hi all
i wrote a simple program to drive a stepper motor behind a "leadshine" driver
a simple switch to give the direction rotation and a potentiometer to drive speed between 30rpm to 800 rpm
for gain speed a short loop is used
what i want is to change cpu speed clock setfreq m8 at motor start and when launched, change to setfreq em64.this is done using comsetup and setintflags
at begining potentiometer rise up with low speed and passing over a threshold , freq is siwtched to 64mhz
it don't run correctly
there is something i misunderstood but what?
here is one example of tens tests i tryed
perhaps somebody could help me?
thanks
pic18f45k22
#picaxe 40x2
setfreq m8
symbol compvalue_ = b2
symbol potentiometre = w0
symbol pulse = c.2
low C.6
adcsetup = A.1
'9876543210 76543210
compsetup %0010100010,%10011110
'flags mask
setintflags %00010000,%00010000
compvalue = 0
marche:
readadc10 A.1 , potentiometre
pulsout C.2 , 1 pauseus potentiometre 'debug'sound A.0,(100,50)
goto marche
interrupt:
setintflags off
if compvalue > 1 then setfreq em64 else setfreq m8 endif 'debug
setintflags %00010000,%00010000
return
i wrote a simple program to drive a stepper motor behind a "leadshine" driver
a simple switch to give the direction rotation and a potentiometer to drive speed between 30rpm to 800 rpm
for gain speed a short loop is used
what i want is to change cpu speed clock setfreq m8 at motor start and when launched, change to setfreq em64.this is done using comsetup and setintflags
at begining potentiometer rise up with low speed and passing over a threshold , freq is siwtched to 64mhz
it don't run correctly
there is something i misunderstood but what?
here is one example of tens tests i tryed
perhaps somebody could help me?
thanks
pic18f45k22
#picaxe 40x2
setfreq m8
symbol compvalue_ = b2
symbol potentiometre = w0
symbol pulse = c.2
low C.6
adcsetup = A.1
'9876543210 76543210
compsetup %0010100010,%10011110
'flags mask
setintflags %00010000,%00010000
compvalue = 0
marche:
readadc10 A.1 , potentiometre
pulsout C.2 , 1 pauseus potentiometre 'debug'sound A.0,(100,50)
goto marche
interrupt:
setintflags off
if compvalue > 1 then setfreq em64 else setfreq m8 endif 'debug
setintflags %00010000,%00010000
return
Attachments
-
825 bytes Views: 3