DEMO9S08QD4 Freescale Semiconductor, DEMO9S08QD4 Datasheet - Page 10

BOARD DEMO FOR MC9S08QD FAMILY

DEMO9S08QD4

Manufacturer Part Number
DEMO9S08QD4
Description
BOARD DEMO FOR MC9S08QD FAMILY
Manufacturer
Freescale Semiconductor
Type
MCUr
Datasheets

Specifications of DEMO9S08QD4

Contents
Board, Cable, CD
Processor To Be Evaluated
MC9S08QD
Data Bus Width
8 bit
Interface Type
USB
Silicon Manufacturer
Freescale
Core Architecture
HCS08
Core Sub-architecture
HCS08
Silicon Core Number
MC9S08
Silicon Family Name
S08QD
Rohs Compliant
Yes
For Use With/related Products
MC9S08QD2, MC9S08QD4
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Describing the Code
At the end of the subroutine, the flag
StateIdle
Established in
Current_position
the stepper motor. Positions are multiplied by four steps in this example. This can be customized in the
code as needed.
As established in
Required_Position
10
3.
4.
5.
6.
If the
If the
is bigger or smaller. This indicates if it needs to move forward or backwards.
If the
variables are equal.
If the
variables are equal.
routine is a counter to do a delay.
MOVE_STEPPER_FORWARD
MOVE_STEPPER_BACKWARDS
Required_Position
Required_Position
Required_Position
Required_Position
Table 1
If requiring fewer then four steps, obey
not miss the sequence, remember to store the last value in port A. Use the
last used value as the last step to generate the next step.
Driving a Stepper Motor Based on the MC9S08QD4 and Other 8-bit Families, Rev. 0
Table 1
PTAD=0x0A;
PTAD=0x09;
PTAD=0x05;
PTAD=0x06;
PTAD=0x00;
Current_position++;
) times. Each time the motor moves, the movement is composed of four small steps of
PTAD=0x0A;
PTAD=0x06;
PTAD=0x05;
PTAD=0x09;
PTAD=0x00;
Current_position--;
) times.
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
StateIdle();
and
and
Figure
Figure 9
is smaller than the
is different than the
is bigger than the
is equal to the
9, the stepper motor moves forward (
subroutine:
subroutine: When the
Check
the stepper motor moves backwards (
is set.
When the
Current_position
Current_position
Current_position
NOTE
Current_position
Table 1
Check
Check
flag is set as
and
flag is set as
, the motor moves backwards until both
, the code goes to idle until
, then the motor moves forward until both
Figure 9
, it is important to check if the difference
Required_Position -
CHECKED
CHECKED
Current_position -
sequences. To
port A is set to:
, port A is set to:
Freescale Semiconductor
Idle_DONE
is set.

Related parts for DEMO9S08QD4