The tcDspStepper class may be used to provide access to a single Stepper core. Each instance of tcDspStepper provides motion control access to 1 stepper motor. The tcDspStepper is intended to server as a base class for various MityDSP microstepping interface chips. Typically, stepper objects should be instantiated using derived classes, such as the tcDspStepper3967.
When created, the constructor requires a valid base address for the stepper core. Optionally, the user may provide a pointer to a tcDspStepperConfig structure to provide pulse initialization parameters. This structure is not referenced (and may be deleted or freed) after initialization.
Note: the Stepper class is not thread safe. It is assumed that only one controlling thread will access any given Stepper object. If multi-thread access is required, the application must provide serialization interlocks.
This is a simple example of tcDspStepper creation and usage:
{ unsigned int values; unsigned int my_base_addr = 0xB0000018; tcDspStepper* my_stepper; tcDspStepperConfig my_config; SEM_Handle my_Handle; // Set up Desired configuration.... // Override min/max frequencies and default acceleration levels my_config.mnAccelRate = 100; // Hz / sec my_config.mnMinPulseRate = 100; // Hz my_config.mnMaxPulseRate = 1000; // Hz // create a Stepper interface my_stepper = new tcDspStepper((void *)my_base_addr, &my_config); // Seek switch position 2 my_stepper->LocateSwitchPosition(&my_Handle, eePOSITION2, eeFORWARD); // wait for completed operation SEM_pend(my_Handle); // Move 30 steps forward my_stepper->Move(&my_Handle, eeFORWARD, 30); // wait for completed operation SEM_pend(my_Handle); ... }