Hardware Reference
In-Depth Information
bset
PTJ,$01
; “
bset
PTJ,$01
; “
bset
PTJ,$01
; “
bset
PTJ,$01
; “
bset
PTJ,$01
; “
bra
loop
; to complete the D/A conversion
;
org
$FFFE
; uncomment this line for CodeWarrior
;
dc.w
start
; uncomment this line for CodeWarrior
end
The C language version of the program is as follows:
#include “c:\cwHCS12\include\hcs12.h”
void main(void)
{
DDRB
5 0xFF;
// configure PORTB for output
DDRJ
| 5 0x03;
// configure pins PJ1 , PJ0 for output
PTJ
& 5 0xFD;
// pull the signal A/B to low to select channel A
while (1) {
PORTB 15 1;
PTJ & 5 0xFE;
// generate a rising edge
PTJ | 5 0x01;
//
PTJ | 5 0x01;
// use dummy statements to provide 2 µs
PTJ | 5 0x01;
// time for D/A conversion to complete
PTJ | 5 0x01;
PTJ | 5 0x01;
PTJ | 5 0x01;
PTJ | 5 0x01;
PTJ | 5 0x01;
PTJ | 5 0x01;
PTJ | 5 0x01;
}
}
The AD7302 can be used to generate many interesting waveforms. Several exercise problems
are given on the applications of this DAC at the end of the chapter.
7.11 Stepper Motor Control
Stepper motors are digital motors. They are convenient for applications where a high degree
of positional control is required. Printers, tape drives, disk drives, and robot joints, for example,
are typical applications of stepper motors.
7.11.1 Principles of Rotation for the Stepper Motor
In its simplest form, a stepper motor has a permanent magnet rotor and a stator consisting
of two coils. The rotor aligns with the stator coil that is energized. By changing which coil is
energized, as illustrated in the following figures, the rotor is turned.
In Figure 7.37a-d, the permanent magnet rotor lines up with the coil pair that is energized.
The direction of the current determines the polarity of the magnetic field, and thus the angular
 
Search WWH ::




Custom Search