Download presentation

Presentation is loading. Please wait.

Published byJaden York Modified over 4 years ago

1
MINOS 04 Software for Stepper Motors Pete Harrison

2
http://micromouse.cannock.ac.uk/Pete Harrison2 Why Steppers Easy to get going Simple Hardware Simple Software Open Loop Easy mechanics

3
http://micromouse.cannock.ac.uk/Pete Harrison3 Why Not Steppers Poor Power to Weight ratio High Current Drain Open Loop Tricky to drive at speed

4
http://micromouse.cannock.ac.uk/Pete Harrison4 Stepper Characteristics Open loop digital control One pulse gives one step Fixed step size Resonances

5
http://micromouse.cannock.ac.uk/Pete Harrison5 Constant speed Constant speed implies constant drive frequency Jitter can cause mis-stepping A lost step is the last step Poor torque at speed Some speeds will suffer from resonances

6
http://micromouse.cannock.ac.uk/Pete Harrison6 Acceleration Accelerate quickly through resonances Dont start too slowly Changes only happen at each step That is – a fixed distance not a fixed time so cant just add a time interval Acceleration has to be adjusted at each step

7
http://micromouse.cannock.ac.uk/Pete Harrison7 Hardware Requirements Digital controls –Step (one each) –Direction (one each) –Enable (shared) Accurate timing source for a pulse generator 2 ms -1 probably implies 2500Hz each

8
http://micromouse.cannock.ac.uk/Pete Harrison8 Software Requirements Each motor needs independent pulse train. Frequency sets speed Pulse length not critical Frequency changes on the fly to accelerate and decelerate

9
http://micromouse.cannock.ac.uk/Pete Harrison9 Timer Options Software Loops Dual timers – separate interrupts Single timer – single interrupt Single timer – Output compare/PCA Slave Processor

10
http://micromouse.cannock.ac.uk/Pete Harrison10 Software timing Simple to design and execute Step on demand Tricky to coordinate actions Low speeds Poor performance

11
http://micromouse.cannock.ac.uk/Pete Harrison11 Single Timer Frequency division/synthesis Set to a high rate – say 5kHz On each interrupt add constant to accumulator On overflow, perform action ALL motor code must run in the same time slot e.g. 16 bit accumulator, constant = 3932 => f=5000*3932/65536 = 300Hz Convenient overflow in assembler There will be jitter

12
http://micromouse.cannock.ac.uk/Pete Harrison12 Dual Timers The easy way if you have them Two 16 bit timers needed One timer interrupt per motor Independent unless the timers are simultaneous Check interrupt priorities – they need to be high

13
http://micromouse.cannock.ac.uk/Pete Harrison13 One Timer with Output Compare Fairly common –8051 derivatives (PCA) –AVR (OCRx) –PIC (Timer 1 CCPx) Single 16 bit timer with independent interrupts at user set rates Low overhead

14
http://micromouse.cannock.ac.uk/Pete Harrison14 Trapezoidal Profile

15
http://micromouse.cannock.ac.uk/Pete Harrison15 Calculating Acceleration Steppers need distance instead: Normally work with time as independent variable:

16
http://micromouse.cannock.ac.uk/Pete Harrison16 Calculating Acceleration For each step we need the interval to the next step Either –Calculate on the fly (square root) Or –Pre-calculate a lookup table

17
http://micromouse.cannock.ac.uk/Pete Harrison17 Lookup Table Use Excel or a program and load into mouse – can live in ROM/FLASH Several tables can live in memory Calculate whenever we need different speed/acceleration – needs to be in RAM May need 1024 16 bit values

18
http://micromouse.cannock.ac.uk/Pete Harrison18 Typical Table

19
http://micromouse.cannock.ac.uk/Pete Harrison19 Using the Table Acceleration is just working through the table, picking out values Maximum speed is a number that tells us how far into the table to go Each entry is one step so speed index is also the number of steps to come to a halt

20
http://micromouse.cannock.ac.uk/Pete Harrison20 Typical Acceleration

21
http://micromouse.cannock.ac.uk/Pete Harrison21 Sample Code // motor interrupt interrupt [TIM1_COMPA] void timer1_compa_isr(void){ UINT temp; if (!steppersEnabled) return;// global bit variable temp = OCR1A; // remember the counter value STEP_LEFT=0;// get the pulse done early delay_us(5);// we only need a short pulse STEP_LEFT=1; remaining--;// one more step done if (remaining <= 0) arrived = 1; // global flag if (currentSpeed < remaining)// accelerate if we can currentSpeed++; else// be sure we are able to decelerate currentSpeed--; if (currentSpeed > maxSpeed) // not too fast currentSpeed = maxSpeed; if (currentSpeed < 0) // or off the table currentSpeed = 0; OCR1A = temp + acc_table[currentSpeed]; }

22
MINOS 04 Software for Stepper Motors Pete Harrison

Similar presentations

OK

A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.

A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google

Ppt on world war 1 Ppt on trans-siberian railway stops Ppt on different types of flowers Ppt on db2 introduction to statistics Ppt on pulse code modulation Ppt on types of forest in india Ppt on water conservation free download Ppt on red blood cells Download ppt on indus valley civilization pictures Ppt on economic order quantity calculator