StepperII
Dual Axis Stepper Controller

CLmd18245.h

00001 
00002 #pragma once
00003 
00004 #include "CBitio.h"
00005 #include "CMotor.h"
00006 
00007 // This is the step data tables
00008 //  Nibbles are [B Data][A Data]
00009 const char fullStepData[] =
00010         { 0x0F, 0xF0};
00011 const char halfStepWTData[] =
00012         //{ 0x0F, 0xFF, 0xF0, 0xFF };
00013         { 0x0F, 0xBB, 0xF0, 0xBB };
00014 const char quarterStepWTData[] =
00015         { 0x0F, 0x6E, 0xBB, 0xE6, 0xF0, 0xE6, 0xBB, 0x6E };
00016 const char eigthStepWTData[] =
00017         { 0x0F, 0x3F, 0x6E, 0x8C, 0xBB, 0xC8, 0xE6, 0xF3,
00018           0xF0, 0xF3, 0xE6, 0xC8, 0xBB, 0x8C, 0x6E, 0x3F };
00019 const char sixteenthStepWTData[] =
00020         { 0x0F, 0x1F, 0x3F, 0x4E, 0x6E, 0x7D, 0x8C, 0xAC,
00021           0xBB, 0xCA, 0xC8, 0xD7, 0xE6, 0xE4, 0xF3, 0xF1,
00022           0xF0, 0xF1, 0xF3, 0xE4, 0xE6, 0xD7, 0xC8, 0xCA,
00023           0xBB, 0xAC, 0x8C, 0x7D, 0x6E, 0x4E, 0x3F, 0x1F };
00024 
00025 class CLmd18245:public CMotor                   // Define hardware interface to LMD18245 devices
00026 {
00027 #define DATA_PORT       PORTD                           // Define the data port
00028 CBit(B, 6, WO) dirA;    // Define the direction A bit
00029 CBit(B, 5, WO) dirB;    // Define the direction B bit
00030 CBit(B, 4, WO) brake;   // Brake output bit - here for initialization to 0
00031 
00032 public:
00033         void init(CProfile *pProfile, CRunProfile *pRunProfile);        // Initialize device
00034         void initHardware(void);
00035         void setBrakeType(char x);                      // 0 clear H-bridge data, 1 short coils, 2 nothing
00036         void brakeOn(void);                                     // Turn on brake
00037         void brakeOff(void);                            // Turn off brake
00038 
00039         void profileChanged(void);                      // Process new profile settings
00040         void changeDirection(void);                     // Change current direction
00041         void setDirection(void);
00042         void step(void);                                        // Do a step (within a sequence of many)
00043         void singleStep(void);                          // Do one step
00044 };
 All Classes Files Functions Variables Defines