4.3. PICDEM DC Motor Test Programs

• Motor test program

• Rev counter program

The primary target device on the board is the DC motor. The hardware configuration is shown in Figure 4.8. The first program just switches the motor on and off, and the second shows how to control the speed.

Figure 4.8. Block Diagram of Motor Test System

Basic Control

The minimal program (Listing 4.5) shows how to run the mechatronics board under the control of SW2. The motor is connected to Drive1 and Drive2 output terminals, with two output bits of the MCU linked to P1 and N2. When these go high, the motor current is switched on in a forward direction. The output code ...

Get Programming 8-bit PIC Microcontrollers in C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.