dsPIC ® Peripherals have the same I/O as PIC peripheralsThiết bị ngoại vi SPI SDO SDI SCK... Dịch vụ ngắt nhanhReset - GOTO Address Oscillator Fail Trap Stack Error Trap Arithmetic
Trang 1Digital Signal Controller
PIC® MCU or dsPIC® DSC? …
Choose Your Dance Partner
The 16-bit MCU with the power of DSP
Trang 2PIC® MCU or dsPIC® DSC?…
Khái niệm chung về DsPIC(DSC)
Sự phát triển PIC18 và dsPIC30F
Các khải niệm cơ bản về vi điều khiển đề cập trong thực tế dsPIC DSC
Trang 3dsPIC ® Peripherals have the same I/O as PIC peripherals
Thiết bị ngoại vi
SPI
SDO SDI SCK
Trang 4Công cụ
Công cụ này hỗ trợ PIC 18, 30, 32
Trang 5Ví dụ chơi nhạc
Did you know that a MP3 Player
is doing
DSP Processing
Trang 6DSP Audio System
Hệ thống cụ thể
Tín hiệu âm thanh với nhiễu
10011011 01110101 11001011
Noisy Audio
dsPIC30F6014
Digital Filter
Sử dụng bộ lọc FIR để lọc tín hiệu vào
Clear Audio
10011100 01110111 11001101
Gửi tín hiệu đầu ra theo thời gian thực
Trang 7 Lọc tín hiệu vào
cao
Trang 8DSP Motor Control System
Trong hệ này
Điện áp điều khiển tính bởi Digital Control Loop t
Motor Position 10011011 01110101 Motor Voltage
11001011
10011100 01110111 11001101
Digital Control Loop
Trang 9DSP Key Words
Digital Control Loop
Trang 10DSP phanh chống trượt (ABS)
Ở hệ thống này
Vi điều khiển sử dụng Digital Filters để lọc tín hiệu tốc độ
ABS Brakes
10011011 01110101 11001011
Digital Filter / Control Loop
10011100 01110111 11001101
Wheel Speed
Trang 11Lệnh DSP chuyên dụng
Ví dụ về nhân 32 bit
MAC instruction – Multiply and Accumulate
Also Multiply and Subtract, Square and Accumulate, etc.
19 special DSP instructions total
MULTIPLY, DIVIDE and bit shift instructions
REPEAT instruction – repeats an instruction many times
Với phương trình sau, chỉ cần 2 câu lệnh và 5 chu kỳ lệnh
[ ] n = b0x [ ] n + b1x [ ] n − 1 + b2x [ ] n − 2 + b3x [ ] n − 3
y
Trang 12DSP chuyên dụng
dsPIC® DSC tốc độ xử lý Real Time
30 MIPS – có khả năng tính 30 triệu phép tính/ 1s
Nâng cao độ chính xác
Trang 13Bộ nhớ chương trình
Does your customer have a big …
PROGRAM?
Trang 14dsPIC30F CPU
4M x 24-bit
Linear Program Space
Byte Flash Memory
144K Flash
4M Total
24 Bit Instruct ion
Trang 15Tối ưu cho C compiler
Processor Features that Dance with the C Compiler
for Efficient Code
Trang 16So sánh tốc độ
Software stack
+Working Register Array
+New MCU instructions
+More flexible addressing
Trang 17Cung cấp Stack
MCU sử dụng stack trong
RAM trong
dsPIC® DSC sử dụng Stack
cho RAM ngoài
C compiler sử dụng Stack
PC<15:1>
PC<22:16> 000000000
0 Parameter 3 = W2 Parameter 2 = W1 Parameter 1 = W0 INT34 return addr
W15 >
SUBR3 return addr
Trang 18New Addressing Modes
File Register (PIC18 Compatible)
ADD 0x500,WREG
Register Direct
ADD W4, W5, W6
Register Indirect
ADD # 500, W6
compiler access data with minimum overhead.
Trang 19Xử lý ngắt
How fast can we Interrupt the code?
Trang 20Dịch vụ ngắt nhanh
Reset - GOTO Address
Oscillator Fail Trap
Stack Error Trap Arithmetic Error Trap
Reserved Reserved Reserved Address Error Trap
INT0 Vector Capture 1 Vector Compare 1 Vector
•
•
Interrupt 53 Vector
0x000000 0x000002 0x000004
Reset - GOTO Instruction
0x00007E
Higher Priority Interrupt
Reserved
Timer 1 Vector Capture 2 Vector Compare 2 Vector
Cung cấp dịch vụ ngắt nhanh
Interrupt Vector Table (IVT)
53 dịch vụ ngắt khác nhau
7 mức ưu tiên
Trang 21Chức năng
hỗ trợ phụ
System Management Features
make sure dsPIC ® DSC keeps dancing
Trang 22Quản lý hệ thốngChức năng cơ bản của MCU
♥Hỗ trợ Watchdog Timer sử dụng internal RC
oscillator
Programmable Time out: 2 ms - 16 sec
4, 16, 64ms
levels
Trang 23Clock sources
XTL,XT,HS Primary Xtal OSC
Clock Divide
By
1, 4, 16, 64
32KHz Timer1 Xtal
OSC
System Clock
or bypass
Includes 2 Internal RC Oscillators
Primary Oscillator for Crystals
PLL multiplies oscillator source for high frequency operation
Clock divide can optionally slow clock to conserve power
32 kHz for Real Time Clock
Trang 24Kiểm soát năng lượng dsPIC
dsPIC PWRSAV cung cấp , SLEEP and IDLE
SLEEP Mode dừng lõi và toàn bộ ngoại vi
IDLE Mode dừng lõi và
Ngoại vi theo tùy chọn
Ngắt ngoại vi sẽ đưa thiết bị trở lại
Trang 25Fail-Safe Operation
Automatic switch to an internal RC clock
conditions
Oscillator Fail
Address out of range
Stack out of range
Math errors
Trang 26Knowledge Check
The system needs to minimize power, but
receive a character from the UART Which
power saving state should the dsPIC® DSC be in?
A: Sleep mode
B: Idle mode
D: Slacker mode
Trang 27Keeping the beat with dsPIC ® Timers
Trang 28Bộ định thời của dsPIC® DSC
dsPIC DSC có (5) 16-bit General Purpose
Timers / Counters
dsPIC timers là
All dsPIC timers thanh ghi chu kỳ Period
Registers
Trang 29Capture/Compare/PWM (CCP)
PIC® MCU có hệ thống Capture/Compare/PWM (CCP)
dsPIC có 8 kênh Input Capture Channels
dsPIC có 8 kênh Output Compare / PWM
Channels
Trang 30Điều khiển motor
dsPIC ® DSC has a motor control family
whose parts have motor control peripherals
Trang 31Motor Control PWM Module
3-ph Inverter
PFC
AN6 AN2
AN0 QEA QEB INDEX
AN7
PWM3H PWM3L PWM2H PWM2L PWM1H PWM1L
OC1 OCFA
AN1
120 - 240 VAC
AC Motor
Incremental Encoder
Có tới 4 kênh PWM generators
Chế độ điều khiển PWM cho
AC Motors
DC motors
Power supplies
Độ phân giải tới 16bit
Fault detection for safe operation
Trang 32Quadrature Encoder Interface
3-ph Inverter
PFC
AN6 AN2
AN0
QEA QEB INDEX
AN7 PWM3H PWM3L PWM2H PWM2L PWM1H PWM1L
OC1 OCFA
FLTA Fault
AN1
120 - 240 VAC
AC Motor
Incremental Encoder
Trang 33Truyền thông
What s new in dsPIC’
What s new in dsPIC’ ®
Communication Peripherals
Trang 34Vai trò truyền thông
dsPIC ® devices có thể có 2 cổng UART LIN Bus Support
4 Byte FIFO Buffers dsPIC devices có thể có 2 SPI™
16-bit interface dsPIC devices có 1 I 2 C™
Multi-master support dsPIC devices có thể có 2 CAN modules
Trang 35dsPIC® Support of CODECs
input and output in voice or music systems
CODECs are very common in DSP systems
SPI™ Framed Mode interfaces simple CODECs New DCI module interfaces complex CODECs
CODEC
CSCK CSDI CSDO COFS
dsPIC30F6014
Trang 36Giao tiếp Analog
There are 2 A/D Modules used on dsPIC Devices
Trang 37dsPIC® A/D modules
Sample Sequence Control
S/H S/H
AN15
Trang 38dsPIC® A/D modules
Sample Sequence Control
Trang 39Đặc điểm cơ bản
A/D lập trình quét trình tự
Tự động chuyển đổi A/D
Trang 40A: 12-bit A/D
B: 10-bit A/D
Trang 41Đặc điểm chung DsPIC
dsPIC DSC là VĐK 16-bit
dsPIC DSC hỗ trợ hệ thống DSP
Digital Control Loops
dsPIC DSC can efficiently handle large,
complex programs
dsPIC hỗ trợ điều khiển motor control family
dsPIC hỗ trợ Codec
dsPIC hỗ trợ AD tốc độ cao
Trang 42Khi nào cần DsPIC
Hệ thống yêu cầu tính toán phức tạp 16-32 bit
Đáp ưng Real Time
Hệ thống yêu cầu
Digital Filters
Bao gồm chương trình C phức tạp
Cần ngoại vi chuyên dụng cung cấp bởi VDK