Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week2.

Similar presentations


Presentation on theme: "Week2."— Presentation transcript:

1 week2

2 Table of contents Established of the enviroment
How to use mikroC PRO for PIC How to use PICkit3 Practical content Check with an oscilloscope

3 Established of the enviroment
・mikroC_PRO_PIC_2013_Build exe ・PICkit3Setup.msi Run each of the above executables.

4 How to use mikroC PRO for PIC

5 ①New Project  Wizard is opened ②Next ①Click 【New Project】.  The wizard will be opened. ②Click 【Next】.

6 ④Select Device Name  “P18F25K22” ⑥Next ⑤Next ④Select a device name from the pull-down menu.  “P18F25K22” ⑤There is no need to change.  Click 【Next】. ⑥Click 【Next】. ⑦Click 【Next】. ⑦Next

7 How to use PICkit3

8 ①File → Import Hex  Select Hex file ①Click 【File】 → 【import Hex】.  Select Hex file.

9 ②Write ②Click 【Write】.  Program is written to PIC.

10 ③Confirm display ③Confirm display.  If display is green, programming is success.  Otherwise, programming is failure.  Check your program.

11 Practice content Circuit for blinking LED at intervals of 1second. Method PIC 18F25K22 Issues 1.How do I get 16 MHz? 2.How do I know it's running at 16 MHz? 3.What is the maximum operating frequency?

12 Internal setteings Select Internal oscillator block Enabled
Change to 16MHz Select a “Internal oscillator block” from the “Oscillator Selection” of pull-down menu. Oscillator Frequency change to 16MHz. Select a “Enabled” from the “4xPLL Enable” of pull-down menu. Select a “Enabled” from the “Primary clock enable bit” of pull-down menu.

13 Source code(ovjective3:Deficit)
void main() { OSCCON = 0b ; OSCTUNE.PLLEN = 1; OSCCON2.PLLRDY = 1 TRISA = 0; do { LATA = 0x00;      Delay_ms(1000); LATA = 0xFF; } while(1); } Circuit diagram PortA:OUTPUT PortA :0 Wait 1000ms PortA:1

14 The primary clock can be set up to 16 MHz in PIC 18F25K22.
OSCCON = 0b ; The primary clock can be quadrupled by passing through the PLL circuit. Maximum operating frequency = 16 x 4 = 64MHz OSCTUNE.PLLEN = 1; PLL   enable OSCCON2.PLLRDY = 1; Primary clock frequency 4x multiplier System clock comes from 4xPLL p31 111 16MHz 110 8MHz 101 4MHz 100 2MHz 011 1MHz

15 Check with an oscilloscope
The oscillation frequency is set to 16 MHz and ON and OFF are repeated every 1 second.


Download ppt "Week2."

Similar presentations


Ads by Google