Stepper-Motor-Control
v3.0.0
System on a Chip 2014 - Group 04
|
Header file with inline functions to access the registers that are used by the Stepper-Motor-Control VHDL-component. More...
Go to the source code of this file.
Macros | |
#define | CTRL_REG_RS_MSK (0b00000001) |
Run (1) or Stop (0)-Bit. | |
#define | CTRL_REG_LR_MSK (0b00000010) |
Left (0) or Right (1)-Bit. | |
#define | CTRL_REG_MODE_MSK (0b00111100) |
Mode-combination according to ctrlRegSet()-function. | |
#define | CTRL_REG_IE_MSK (0b01000000) |
Interrupt-Enable Bit. | |
#define | CTRL_REG_IR_MSK (0b10000000) |
Interrupt-Request Bit. | |
#define | MODE_STOP_CON_RUN_MSK (0b0011) |
Bit 0 & 1 only. | |
#define | MODE_STOP (0b0000) |
MODE_STOP_CON_RUN_MSK; Must be 0b00 | |
#define | MODE_CON_RUN (0b0001) |
Use "MODE_STOP_CON_RUN_MSK"; Must be 0b01 | |
#define | MODE_CH_OF_ST_1_4 (0b0010) |
Bits must be 0b0010 | |
#define | MODE_CH_OF_ST_1_2 (0b0110) |
Bits must be 0b0110 | |
#define | MODE_CH_OF_ST_1 (0b1010) |
Bits must be 0b1010 | |
#define | MODE_CH_OF_ST_2 (0b1110) |
Bits must be 0b1110 | |
#define | IOWR_REGS_ADDR(base, addr, data) IOWR(base, addr, data) |
base address of the complete register interface component | |
Ctrl-Register | |
#define | REGS_CTRL 0b000 |
address offset Ctrl-Register | |
#define | IOADDR_REGS_CTRL(base) __IO_CALC_ADDRESS_NATIVE(base, REGS_CTRL) |
Macro to calculate the address of the Ctrl-Register. | |
#define | IORD_REGS_CTRL(base) IORD(base, REGS_CTRL) |
Macro to read Ctrl-Register. | |
#define | IOWR_REGS_CTRL(base, data) IOWR(base, REGS_CTRL, data) |
Macro to write Ctrl-Register. | |
static __inline__ void | ctrlRegSet (uint8_t newCtrlReg) |
Overwrites the complete CtrlReg. More... | |
static __inline__ uint8_t | ctrlRegGet (void) |
Returns the actual content of the control-register. More... | |
CtrlSet-Register | |
#define | REGS_CTRL_SET 0b001 |
address offset CtrlSet-Register | |
#define | IOADDR_REGS_CTRL_SET(base) __IO_CALC_ADDRESS_NATIVE(base, REGS_CTRL_SET) |
Macro to calculate the address of the CtrlSet-Register. | |
#define | IORD_REGS_CTRL_SET(base) IORD(base, REGS_CTRL_SET) |
Macro to read CtrlSet-Register. | |
#define | IOWR_REGS_CTRL_SET(base, data) IOWR(base, REGS_CTRL_SET, data) |
Macro to write CtrlSet-Register. | |
static __inline__ void | ctrlRegBitSet (uint8_t bitsToSet) |
Sets the CtrlReg bitwise. More... | |
CtrlClr-Register | |
#define | REGS_CTRL_CLR 0b010 |
address offset CtrlClr-Register | |
#define | IOADDR_REGS_CTRL_CLR(base) __IO_CALC_ADDRESS_NATIVE(base, REGS_CTRL_CLR) |
Macro to calculate the address of the CtrlClr-Register. | |
#define | IORD_REGS_CTRL_CLR(base) IORD(base, REGS_CTRL_CLR) |
Macro to read CtrlClr-Register. | |
#define | IOWR_REGS_CTRL_CLR(base, data) IOWR(base, REGS_CTRL_CLR, data) |
Macro to write CtrlClr-Register. | |
static __inline__ void | ctrlRegBitClr (uint8_t bitsToClr) |
Clears the CtrlReg bitwise. More... | |
Speed-Register | |
#define | REGS_SPEED 0b011 |
address offset Speed-Register | |
#define | IOADDR_REGS_SPEED(base) __IO_CALC_ADDRESS_NATIVE(base, REGS_SPEED) |
Macro to calculate the address of the Speed-Register. | |
#define | IORD_REGS_SPEED(base) IORD(base, REGS_SPEED) |
Macro to read Speed-Register. | |
#define | IOWR_REGS_SPEED(base, data) IOWR(base, REGS_SPEED, data) |
Macro to write Speed-Register. | |
static __inline__ void | speedRegSet (uint8_t newSpeed) |
Sets the speed, how fast the Stepper-Motor-Control turns the motor. More... | |
static __inline__ uint8_t | speedRegGet (void) |
Returns the actual content of the speed-register. More... | |
Steps-Register | |
#define | REGS_STEPS 0b100 |
address offset Steps-Register | |
#define | IOADDR_REGS_STEPS(base) __IO_CALC_ADDRESS_NATIVE(base, REGS_STEPS) |
Macro to calculate the address of the Steps-Register. | |
#define | IORD_REGS_STEPS(base) IORD(base, REGS_STEPS) |
Macro to read Steps-Register. | |
#define | IOWR_REGS_STEPS(base, data) IOWR(base, REGS_STEPS, data) |
Macro to write Steps-Register. | |
static __inline__ void | stepsRegSet (uint32_t newStepCount) |
Sets the given steps for the Stepper-Motor-Control VHDL-component. More... | |
static __inline__ uint32_t | stepsRegGet (void) |
Returns the actual content of the steps-register. More... | |
Header file with inline functions to access the registers that are used by the Stepper-Motor-Control VHDL-component.
The bitmask is as follows:
Bit | Function | Usage |
---|---|---|
7 | IR | The Interrupt that will be set via the VHDL Stepper-Motor-Control |
6 | IE | IE (Interrupt Enable) to enable the interrupt for Chain of Steps |
2..5 | MODE | Mode according to table below |
1 | LR | Turn the motor Left (0) or Right (1) |
0 | RS | Run (1) or Stop (0) the motor |
Modes | Effect |
---|---|
xx00 | Stop |
xx01 | Continuous Run |
0010 | Chain of Steps (1/4 rotation) |
0110 | Chain of Steps (1/2 rotation) |
1010 | Chain of Steps (1 rotation) |
1110 | Chain of Steps (2 rotations) |
other | reserved |
v0.1.0 02.11.2014 Riedel
v0.1.1 03.11.2014 Kossmann
v0.1.2 04.11.2014 Kossmann
v1.0.0 11.11.2014 Riedel & Kossmann
v1.0.1 15.11.2014 Kossmann
v2.0.0 18.11.2014 Riedel & Kossmann
Definition in file registerAccess.h.
|
static |
Clears the CtrlReg bitwise.
Writes into ctrlClrReg in register interface which modifies the ctrlReg accordingly.
bitsToClr | Bits to clear in CtrlReg |
Definition at line 152 of file registerAccess.h.
|
static |
Sets the CtrlReg bitwise.
Writes into ctrlSetReg in register interface which modifies the ctrlReg accordingly.
bitsToSet | Bits to set in CtrlReg |
Definition at line 128 of file registerAccess.h.
|
static |
Returns the actual content of the control-register.
CtrlReg content is stored in external register interface
Definition at line 104 of file registerAccess.h.
|
static |
Overwrites the complete CtrlReg.
CtrlReg content is stored in external register interface
newCtrlReg | The new register-content to set |
Definition at line 95 of file registerAccess.h.
|
static |
Returns the actual content of the speed-register.
The speed-step is used accordingly to the speedRegSet()-function.
Definition at line 198 of file registerAccess.h.
|
static |
Sets the speed, how fast the Stepper-Motor-Control turns the motor.
The speed ranges from 0 (very slow, used for debugging, each step can be monitored with the LEDs) to 7 (maximum speed). See the following table for more information:
speed | pulse-width (t_pulse) |
---|---|
0 | 2 s |
1 | 1 s |
2 | 500 ms |
3 | 250 ms |
4 | 100 ms |
5 | 50 ms |
6 | 25 ms |
7 | 10 ms |
newSpeed | The new speed from 0 to 7 (only the first 3 bits are used!). |
Definition at line 188 of file registerAccess.h.
|
static |
Returns the actual content of the steps-register.
The register contains a 32-bit integer value since the last start of the motor.
Definition at line 231 of file registerAccess.h.
|
static |
Sets the given steps for the Stepper-Motor-Control VHDL-component.
The VHDL-component moves the motor according to this step-count.
newStepCount | The number of steps, the motor should turn. |
Definition at line 222 of file registerAccess.h.