In this PPT, all the materials covered up for the PIC
microcontroller set-up would be studied. Preliminary skills:
Knowing of basic C grammar and basic circuit analysis, and manual
reading. PIC Microcontroller DASL Motor Control Tutorial
Slide 2
Introduction PIC stands for Peripheral Interface Controller.
PIC is a family of Harvard architecture microcontrollers made by
Microchip Technology. PIC is programmed and run by MPLAB software.
In this tutorial, dsPIC33F - J128MC804 model will be used. 2
Slide 3
Peripheral Pins As shown in Fig 1 and 2 (on next slide), all
the peripheral PINs having different functions are commanded.
Figure 1 3
Slide 4
Figure 2 Peripheral Pins 4
Slide 5
Each of peripheral PINs are commanded for different functions
such as ADC, PWM, GIO(General Input & Output), QUART, QEI, etc.
In the next two slides, Table 1-1 shows the PIN names and what all
the PINs are functioning for. Depending on the purpose of a
experiment, specific PINs need to be used and wired on the proper
device. Peripheral Pins 5
Slide 6
6
Slide 7
7
Slide 8
Tips for Manual Search All the manuals are provided on
Microchip Technologys website - http://www.microchip.com/,
therefore you can easily search the functions and pins that you
want to use.http://www.microchip.com/ Since all the provided
manuals are PDF files you can easily search the key word by CTRL +
F. All the necessary manuals for motor control are provided on the
last slide of this PPT. 8
Slide 9
Hardware dsPIC33F - J128MC804 MPLAB ICD2 & 3 (ICD 3 is
recommended since extra works are necessary for the use of ICD 2) A
compiler sending the data from a computer to a PIC chip and vice
versa. The Base Electric Circuit The properly designed electric
circuit is needed to implement the PIC chip(In this tutorial, the
electric circuit designed by one of the Hubo lab members will be
used). The procedure to make the base circuit will be discussed
later. 9
Slide 10
Software Programs MPLAB C30 compiler OrCAD All the necessary
software programs are provided on the blog. 10
Slide 11
Software Programs MATLAB 11
Slide 12
Software Programs - MATLAB This initial set-up is necessary for
the time interrupt function in the main code. 12
Slide 13
Software Programs - MATLAB 13 All the setups in Init PWM allows
motors to be controlled by PWM signals. You can manually change the
settings based on the qualification of the motor that you use.
Slide 14
Software Programs - MATLAB 14
Slide 15
Software Programs - MATLAB 15 Init QEI function is set up to
enable the users to read the data in real time from an encoder. You
can get the data in a desired format by calculating a proper
mathematical equation.
Slide 16
16 QEI & PWM QEI stands for Quadrature Encoder Interface.
In general, almost all of the encoders have two pins which generate
A & B signals and as shown in Fig 3, signal A and B intersects
consistently and this pattern is converted from the analog signal
to digital signal by the QEI function in PIC chip. There are four
registers in QEI function, which are shown below: Control/Status
Register (QEIxCON) Digital Filter Control Register (DFLTxCON)
Position Count Register (POSxCNT) Maximum Count Register (MAXxCNT)
x is the number of a channel or a register.
Slide 17
QEI & PWM 17 Figure 3
Slide 18
18 QEI & PWM Figure 4
Slide 19
19 PWM stands for Pulse-Width-Modulator. PWM is generally used
for motor control & LED lightness control. PWM tutorial will be
provided on the blog. QEI & PWM
Slide 20
20 QEI & PWM
Slide 21
21 QEI & PWM (Channel) MC PTEN Prescale PTMOD Pair mode Pin
enable Iue Dead time
30 QEI & PWM (Pin Setting) As shown in the preceding slides
there are two channels and for first module there are three sets of
high and low signals and for second module there is only one set of
the signals.
Slide 31
31 QEI & PWM (Dead Time) It is enabled only in
complementary mode. To prevent a electric short in a circuit.
Slide 32
32 QEI & PWM (Enabling) This register is used to enable PWM
function.