Title: Microcontroller
1????????????????? (Microcontroller)
- ????????????????? ??? ?????????????????????????
????????????????????????????????? ?
???????????????????? ???? ?????????????????
(Central Processing Unit CPU)
??????????????????????????????? (Arithmatic Logic
Unit ALU) ????????????????? (Oscillator)
??????????? (Memory ROM, RAM)
??????????????????????????????????????? (I/O
Port)
2(No Transcript)
3(No Transcript)
4PIC ???????
- PIC ??? microcontroller ??????????????
????????????? Peripheral Interface Controller
???? concept ??????? microcontroller
?????????????? ???????????????????????????????????
?????????????? PROGRAM MEMROY, RAM, EEPROM,
SERIAL, I2C, PWM, A/D ??? ????????????????????????
???????????????? ???????? PIC ????????????????????
??????????? ?????????????????? ???????????????????
?? CPU ????????????????
5?????? 1 ???????????????Microcontroller
6????????????????????????????????? Microcontoller
- ?????????????????????????????????
Microcontoller (??????????????????????? MCU)
??????????????????????????????????????????????????
???????????? ??????????????? - ???????????????? C, Basic ?????????????????,
???????????????? ????????????????????
????????????????????????????? ????????????????????
????????? - ???????????? ????????? ???? Assembly ???????? ???
compiler ?????? ?????????????????? compiled
?????????????? ?????????????????
??????????????????????? ??????????????????????????
???????? ???????????????????
7????????????????????? Microcontroller
???????????????????
- 1. ????????????? Assembly ??? ?????????
?????????????????? Compile ???? Assembler ??? MCU
??????? ????????????????? Chip MCU
??????????????? ?????? Assembler ???Microchip
????? MPASM ??????????????????????????????????????
??????????????? Hex file
8- 2. ??????? Assembly ??????? ????????????????
???? ??????????????? Compile ?????????????????????
Object files ?????????????????? Linker
?????????? link ?????? script file ??? MCU
?????????? ?????? ???????????? Link ???????????
Hex file ?????
9- 3. ??????????????????? ????????? C, Basic ???
????????????????????? ???? assembly
????????????????????????????????? Object files
??? Assmbler ?????????? Assembly ??? Compiled ???
Compiler ????????????? ????? Link ???????????????
Linker ???????????? Link ??????????????? Library
???????????????????????????????????????
???????????????????? Hex file
10- ?????????? Hex file ?????? ?????????????????????
???????? chip ???????????????????
????????????????????? ?? Software ?????????????
??????????????????????????? ????? ???? ??
??????????????????????????? programmer ????
serial, parallel ?????????????????????????????????
???????????? ??????????????????? chip
?????????????????????????????????????????
11?????? 2 ???????????????????????????? PIC
12MPASM http//www.thaimcu.com/article/getstart/www.
microchip.com
???? Assembler ???????????? MICROCHIP
??????????????????????? ??????????????????????????
???????????????????????????? Assembly ????????
download ?????? web site ?????? MICROCHIP
????????????? MPLAB-IDE
13MPLAB C17 ??? MPLAB C18
???? C compiler ?????????? MICROCHIP ??? support
?????????? PIC17XXX ??? PIC18XXX
????????????????????????????? ?????????? compiler
??????????????????????????????
14HITECH-PIC C compilerhttp//www.hitech.com.au/
???? C compiler ??? HITECH ????????????????
compiler ??????????? assembly ???
(???????????????? assembly ???? code ??????????)
??????? software ??????????????????
????????????????????????
15CCS C compilerhttp//www.ccsinfo.com/pice-referal
l.shtml
???? compiler ??????????????????????
???????????????????????????????????????
????????????? file ????????????????? code ???
compiled ?????????????????????????
????????????????? HI-TECH ??? CCS
????????????????
16PBASIC Compilerhttp//www.picbasic.co.uk/
- ??????????????????? BASIC ??????????????
?????????????? ?????????? ????????? ?????????????
?????????????? compiled ?????????????????????? !!
????? chip ????????? ?????????????????????????????
??????? ???????? program ???????????????????????
17PIC ?????????
- MCU ???????? PIC ???????????????????? PROGRAM
MEMORY ??????????? 3 ?????? - OTP (one time programmable)
- EPROM (erasable programable ROM)
- EEPROM / Flash (electronically erasable
programmable ROM)
18- OTP ???? chip ?????????????????? ???????????
???????????????? chip ??? OTP ????????????????????
???????????????????????? ??????? chip
??????????????????????????????????????????????????
??? ??????? chip ?????????????????????????????????
??????????????????????????????? ?????????
???????????? ???????????????????????????????
memory ?????????? ???????????? C ????????? chip
???? 16C84,16C74
19- EPROM ???? chip ????? program memory
??????????????????????????????????????????????????
?????????????????????????? uV (ultra Violet)
????????????????? chip ?????? 5-10 ????
??????????????????? chip ?????????????????????????
uV ????????????????????????? chip ???
??????????????????????????????????????
????????????????????? uV ???? ????????????????????
? ???????????????????????? ???????????? JW
???????????????????????????????? chip ???????
20- EEPROM / Flash ???? chip ??????????????????????
??????? program memory ???????????????????????????
?????????? ???????????? ????????????????????
??????????? ???????????????????????????
???????????????????????? 3 ?????? ?????????? F
?????????? ???? 16F84,16F877
21PIC ??????????
- ???????? MCU ??? PIC ???????????????
????????????????????? ?????????????????????
???????????????? ?????????????????????????????????
????????????? ????????????? 6 ????? ?????? - PIC12CXXX, PIC12FXXX (FLASH MCUs)
- PIC16C5X
- PIC16CXXX
- PIC17CXXX
- PIC16FXXX (FLASH MCUs)
- PIC18CXXX, PIC18FXXX (FLASH MCUs)
22- PIC16C5X - ?????????????? assembly 33 ??????-
?? I/O, Timer, Watch dog- ?? feature ????????
??????? I2C ???? SERIAL ????????? chip
???????????????? ? ??? microchip - ????????????????????????????????????
??????????? OTP ??? EPROM feature ???????? I2C
???? USART ?????????????????????????????????
Microchip ????????????????????????????????????????
????? PIC16CXXX
23- PIC16CXXX- ?????????????? assembly 35 ??????
- - ?? I/O, ?? Timer ??????? 1 ???, Watch dog,
I2C, USART, SPI, PWM- ??????? feature
???????????????? ???????? interface
????????????????????????????? - ??????? feature ??????? ???? I2C, USART, PWM
??????????????????????????????????
????????????????????????? PIC12CXXX ?????
???????? pic ?????????? 8 ?? ?????????????????????
? ???????????? OSC ???? 4 MHz ????? ????? DATA
memory ????????????? EEPROM ?????????????
???????????? PROGRAM memory ??????? OTP ??? EPROM
???? ??????????? PIC12FXXX ??????????????????????
PIC ?????? PIC16FXXX ??????
24- PIC12CXXX ??? PIC12FXXX - ?? 8 ??-
?????????????? assembly ??????? 33 ???? 35
??????- ?? I/O, Timer, Watch dog- ??????????
internal EEPROM- ???? 4MHz oscillator
???????????? chip ??? ?????????????????
oscillator ?????? ( ??????????????????????????????
??????????????? Crystal oscillator ??????) - PIC16CXXX ??? PIC17CXXX ????????????? ???
???????????????? PIC17CXXX ???????????????????????
??? ?????????? assembly ??????? ??????????????
PROGRAM memory ??????????????????????? PIC16CXXX
???????????? memory ???????????
25- PIC17CXXX- ?????????????? assembly 58 ??????
??????????? ??? ???- ???????????? program memory
?????? ????????????? 64K x 16 Program memory- ??
I/O, ?? Timer ??????? 1 ???, Watch dog, I2C,
USART, SPI, PWM - PIC16F8XXX ???? PIC ????????????????????
????????????????????? chip ??????? ????? PROGRAM
MEMORY ??????? FLASH ????? DATA MEMORY ???????
EEPROM ??????????????? ?????????? PROGRAM CHIP
?????????????????? ???????????? In Circuit
Debugger ?????????????? ?????????????????
Emulator ????????????????????
26- PIC16F8XXX (FLASH MCUs)- ?????????????? assembly
35 ??????- ?? I/O, ?? Timer ??????? 1 ???, Watch
dog, I2C, USART, SPI, PWM- ?? A/D ???? 10 bits-
?? Program memroy ??? Flash ??????????????????????
???????- ?? EEPROM ?????- ???????? 16F87X
???????? In Circuit Debugger (ICD) - ?????????? program memory ???????????? page
???????????????????? PIC18CXXX ???? PROGRAM
MEMORY ?????????????? page ????????
?????????????? ASSEMBLY ???? 77 ??????
???????????????? PROGRAM MEMORY
????????????????????????? ??????????????????? C
???????????????????? PIC18FXXX ????? ???????? ICD2
27- PIC18CXXX, PIC18FXXX (FLASH MCUs)-
?????????????? assembly 77 ??????- ?? I/O, ??
Timer ??????? 1 ???, Watch dog, I2C, USART, SPI,
PWM, CAN- ?? A/D ???? 10 bits- ????????????
program memory ?????? ????????????? 64K x 16 -
?? Program memroy ??????? Flash - ????????
18FXXX ?? EEPROM ?????- ???????? 18FXXX ????????
In Circuit Debugging (ICD)
28TYPES OF OSCILLATOR
MCU ???????? PIC ??????????? oscillator
????????????????????????????? ?????? oscillator
????? PIC ???????????? RC oscillator
??????????????? 4 MHz ??? Vdd5 V ??????????? 25
???????????? ??????????????????? ????????
oscillator ?????? RC ?????????????????????????????
??
29- 1. CERAMIC RESONATOR ???????????????????????????
????? ?????? ERROR ??? ?????????????????
?????????????????????????????? OSCILLATOR
?????????????????????? ????????? C ?????????????
??????????????? GND ?????????????????? CLKIN ???
CLKOUT. - 2. QUARTZ CRYSTAL OSCILLATOR ???????????????????
??????? ????? crystal ??????????????????????
????????????? ???????? capacitor ????? GND
???????????? ?????? ?????????????????????? CLKIN
??? CLKOUT ??????????????? CERAMIC RESONATOR
????????????????????????????????????????
30- 3. TTL CRYSTAL SQUAR-WAVE OSCILLATOR ???
oscillator ????? crystal ?????????????????????????
????????? ??????????????????????????????????
?????????????? ??????????????? ?? 14 ??? 5V, ?? 7
??? GND, ?? 8 ?????? CLK IN ?????? ???????????,
?? CLKOUT ??? PIC ????????????