18x to drive stepper power feed

Staffscrocs

New Member
Following my previous post, I have progressed my power feed controller using an 18x and the PWMOUT command. The motor will quite happily start from scratch up to about 140 rpm and I have managed 160 rpm on occasions.However, I am told that I need to program in some form of ramp-up and ramp-down feature for higher speeds.
So, we are at the point where I think I know what to do and which Basic commands to use but exactly how to impliment this is a little daunting.This is how I think it needs to go.

Firstly I set the SETFREQ m8 command.
Then set PWMOUT running at the minimum value.
I have a 10K potentiometer on input 0 and will use READADC to get a variable. This variable then needs to be compared to the PWMOUT minimum values and the PWM period (and duty cyle?)adjusted accordingly using ramp up/down timeframes to come to the new speed.
The PWMOUT needs to be varied from 50 pulses/sec to 2500 pulses/sec to feed to the separate stepper driver unit to give the right motor speeds in the real world.The mark space ratio can be 50/50 or anything really so long as the period gives these pulse rates.
The ramp up/down thing is not too clear to me yet and I think it needs to be done using maths.
Also I suspect that the best way to police the variable input might be using an interupt command but not sure.
Am I on the right track?
If anyone has any nifty code lines for any of the above requirements, I would love to hear from you!
Thanks in advance,
Les
 
Top