Stepper dengan driver TB6600 Microstep Driver
Dependents: StepperTB_Example Lowlevel_function
StepperTB.h@0:7902453bcfef, 2018-10-24 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Oct 24 16:15:53 2018 +0000
- Revision:
- 0:7902453bcfef
- Child:
- 2:787cee5a8dad
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:7902453bcfef | 1 | #ifndef STEPPERTB_H |
irfantitok | 0:7902453bcfef | 2 | #define STEPPERTB_H |
irfantitok | 0:7902453bcfef | 3 | |
irfantitok | 0:7902453bcfef | 4 | #include "mbed.h" |
irfantitok | 0:7902453bcfef | 5 | |
irfantitok | 0:7902453bcfef | 6 | class StepperTB { |
irfantitok | 0:7902453bcfef | 7 | public: |
irfantitok | 0:7902453bcfef | 8 | /*Parameterized CTOR |
irfantitok | 0:7902453bcfef | 9 | *ENA = ENA- |
irfantitok | 0:7902453bcfef | 10 | *DIR = DIR- |
irfantitok | 0:7902453bcfef | 11 | *PUL = PUL- |
irfantitok | 0:7902453bcfef | 12 | *Microstep = jumlah microstep dalam 1 step |
irfantitok | 0:7902453bcfef | 13 | *StepPerRev = jumlah step dalam 1 putaran |
irfantitok | 0:7902453bcfef | 14 | */ |
irfantitok | 0:7902453bcfef | 15 | StepperTB(PinName ENA, PinName DIR, PinName PUL, int Microstep, int StepPerRev); |
irfantitok | 0:7902453bcfef | 16 | |
irfantitok | 0:7902453bcfef | 17 | /*Method*/ |
irfantitok | 0:7902453bcfef | 18 | /*MoveStep |
irfantitok | 0:7902453bcfef | 19 | *Gerakkan stepper sebanyak StepAmt step dengan |
irfantitok | 0:7902453bcfef | 20 | *Selang waktu antar microstep selama Interval (dalam us) |
irfantitok | 0:7902453bcfef | 21 | */ |
irfantitok | 0:7902453bcfef | 22 | void MoveStep(int StepAmt, int Interval); |
irfantitok | 0:7902453bcfef | 23 | |
irfantitok | 0:7902453bcfef | 24 | /*MoveRev |
irfantitok | 0:7902453bcfef | 25 | *Gerakkan stepper sejauh RevAmt putaran dengan |
irfantitok | 0:7902453bcfef | 26 | *Selang waktu antar microstep selama Interval (dalam us) |
irfantitok | 0:7902453bcfef | 27 | */ |
irfantitok | 0:7902453bcfef | 28 | void MoveRev(int RevAmt, int Interval); |
irfantitok | 0:7902453bcfef | 29 | |
irfantitok | 0:7902453bcfef | 30 | //Getter |
irfantitok | 0:7902453bcfef | 31 | //StepPerRev |
irfantitok | 0:7902453bcfef | 32 | int getSPR(); |
irfantitok | 0:7902453bcfef | 33 | //Microstep |
irfantitok | 0:7902453bcfef | 34 | int getMstep(); |
irfantitok | 0:7902453bcfef | 35 | |
irfantitok | 0:7902453bcfef | 36 | private: |
irfantitok | 0:7902453bcfef | 37 | //Pins |
irfantitok | 0:7902453bcfef | 38 | DigitalOut ENA_; |
irfantitok | 0:7902453bcfef | 39 | DigitalOut DIR_; |
irfantitok | 0:7902453bcfef | 40 | DigitalOut PUL_; |
irfantitok | 0:7902453bcfef | 41 | |
irfantitok | 0:7902453bcfef | 42 | int Microstep_; |
irfantitok | 0:7902453bcfef | 43 | int StepPerRev_; |
irfantitok | 0:7902453bcfef | 44 | |
irfantitok | 0:7902453bcfef | 45 | }; |
irfantitok | 0:7902453bcfef | 46 | |
irfantitok | 0:7902453bcfef | 47 | #endif |