1 / 32

PIC Microcontroller

DASL Motor Control Tutorial . PIC Microcontroller. 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. . Introduction.

hedy
Download Presentation

PIC Microcontroller

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DASL Motor Control Tutorial PIC Microcontroller 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.

  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.

  3. Peripheral Pins • As shown in Fig 1 and 2 (on next slide), all the peripheral PINs having different functions are commanded. Figure 1

  4. Peripheral Pins Figure 2

  5. Peripheral Pins • 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.

  6. Peripheral Pins

  7. Peripheral Pins

  8. Tips for Manual Search • All the manuals are provided on Microchip Technology’s website - http://www.microchip.com/, therefore you can easily search the functions and pins that you want to use. • 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.

  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.

  10. Software Programs • MPLAB • C30 compiler • OrCAD • All the necessary software programs are provided on the blog. <MPLAB> <The interface of OrCAD>

  11. Software Programs – MATLAB

  12. Software Programs - MATLAB • This initial set-up is necessary for the time interrupt function in the main code.

  13. Software Programs - MATLAB 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.

  14. Software Programs - MATLAB

  15. Software Programs - MATLAB ‘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.

  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.

  17. QEI & PWM Figure 3

  18. QEI & PWM Figure 4

  19. QEI & PWM • PWM stands for Pulse-Width-Modulator. • PWM is generally used for motor control & LED lightness control. • PWM tutorial will be provided on the blog.

  20. QEI & PWM

  21. QEI & PWM (Channel) <MCPWM1 Module> <MCPWM2 Module> • MC • PTEN • Prescale • PTMOD • Pair mode • Pin enable • Iue • Dead time

  22. QEI & PWM (Frequency)

  23. QEI & PWM (Frequency)

  24. QEI & PWM (Frequency)

  25. QEI & PWM (Mode) Single pulse mode

  26. QEI & PWM (Mode) Single Pulse Mode Free Running Mode

  27. QEI & PWM (Mode) Count Mode

  28. QEI & PWM (Mode)

  29. QEI & PWM (Mode)

  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.

  31. QEI & PWM (Dead Time) • It is enabled only in complementary mode. • To prevent a electric short in a circuit.

  32. QEI & PWM (Enabling) • This register is used to enable PWM function.

More Related