Hi,
Could some one please point me in the right direction! How do I make use of the other timers on the LPC1768? I am using the ticker function to drive a stepper motor (which i think uses timer3),
I beleive I need to make use of the other timer(s) for additional motors as the ticker does not work properly for me as below,
#include "mbed.h"
#include "TextLCD.h"
#include "init.h"
#include "stepper.h"
LocalFileSystem local("local");
Serial pc(USBTX, USBRX);
Ticker xstepper;
Ticker ystepper;
TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3
PwmOut lcdled(p22);
int main() {
X_DIR=1;
lcd.cls();
lcd.locate(0, 0); // ROW 1
lcd.printf(" Hello ");
for (float p = 0.00f; p < 1.00f; p += 0.01f) {
lcdled = p;
wait(0.01);
}
xstepper.attach_us(&step_x, 100);
ystepper.attach_us(&step_y, 100);
XTARGET=10000;
YTARGET=10000;
while(1) {
//main loop
}
The step_x & step_y are like below...
void step_x() {
if (XSTEPS<XTARGET) {
X_STEP=1;
wait_us(1);
X_STEP=0;
XSTEPS++;
}
}
Thanks.
Mike.
Hi,
Could some one please point me in the right direction! How do I make use of the other timers on the LPC1768? I am using the ticker function to drive a stepper motor (which i think uses timer3),
I beleive I need to make use of the other timer(s) for additional motors as the ticker does not work properly for me as below,
The step_x & step_y are like below...
Thanks.
Mike.