Tải bản đầy đủ (.ppt) (42 trang)

DSPIC Digital Signal ControllerPIC® MCU or dsPIC® DSC? …Choose Your Dance Partner

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (675.53 KB, 42 trang )

Digital Signal
Controller
PIC® MCU or dsPIC® DSC? …
Choose Your Dance Partner

The 16-bit MCU with the power of DSP


PIC® MCU or dsPIC® DSC?…
 Khái niệm chung về DsPIC(DSC)
 DSP instructions
 CPU instruction set additions
 Peripheral Features

 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


Thiết bị ngoại vi
dsPIC® Peripherals have the same I/O as PIC peripherals
PIC MCU

dsPIC DSC

TMR

TMR

TMR



CCP

CCP

IC

TMR
IC/OC

OC
TX
UART

RX

TX
UART

SCK
SPI

I2C

SDI

SCK
SPI

SDI


SDO

SDO

SCL

SCL

SDA

I2C

TXx
CAN

RX

RXx

SDA
TXx

CAN

RXx


Công cụ


 Công cụ này hỗ trợ PIC 18, 30, 32


Ví dụ chơi nhạc

Did you know that a MP3 Player
is doing

DSP Processing


DSP Audio System
dsPIC30F6014

Noisy Audio
10011011
01110101
11001011

Digital
Filter

10011100
01110111
11001101

Clear Audio

 Hệ thống cụ thể
 Tín hiệu âm thanh với nhiễu



Sử dụng bộ lọc FIR để lọc tín hiệu vào

Gửi

tín hiệu đầu ra theo thời gian thực

Key Words: Real Time, Digital Filter


DSP Key Words
 Real Time
 Yêu cầu đáp ứng lọc theo thời gian thực của âm

thanh
 Digital Filter
 Lọc tín hiệu vào
 DSP cung cấp lệnh cơ bản hỗ trợ tín toán tốc độ

cao


DSP Motor Control System

Motor Position

10011011
01110101
11001011


Digital
Control
Loop

10011100
01110111
11001101

Motor Voltage

 Trong hệ này
 Encoder đo tốc độ
 Điện áp đầu ra từ D/A của Vi điều khiển
 Điện áp điều khiển tính bởi Digital Control Loop t
 Key Words: Digital Control Loop


DSP Key Words
 Digital Control Loop
 Thực hiện được thuật toán điều khiển phức tạp
 Yêu cầu độ chính xác cao (tĩnh và động)
 Cho phép thực hiện trong thời gian xác định


DSP phanh chống trượt (ABS)

Wheel Speed

10011011

01110101
11001011

Digital
Filter /
Control
Loop

10011100
01110111
11001101

ABS Brakes

 Ở hệ thống này
 Vi điều khiển sử dụng Digital Filters để lọc

tín hiệu tốc độ


Lệ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

y[n]= b0 x[n]+ b1 x[n − 1]+ b2 x[n − 2]+ b3 x[n − 3]


DSP 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

 Thanh ghi của dsPIC® DSC là 16-bits
 dsPIC® DSC có 32-bit multiply - 32-bit divide
 dsPIC® DSC có 40-bit accumulator


Bộ nhớ chương trình
Does your customer have a big …

PROGRAM?


dsPIC30F CPU
 Lõi bao gồm : MCU + DSP
 Lệnh 24-bit wide

4M
Total


 Total Space:

4M x 24-bit
Linear Program Space
 Bộ nhớ chương trình 144K
Byte Flash Memory

24 Bit
Instruct
ion

144K
Flash


Tối ưu cho C compiler

Processor Features that Dance with the C Compiler
for Efficient Code


So sánh tốc độ

Infineon C16X

Hitachi H8S

Motorola HC12

Mitsubishi M16


dsPIC C30 v1.10

Software stack
+
Working Register Array
+
New MCU instructions
+
More flexible addressing
=
Smallest C code

32-bit Math intensive Code
(~ 50KB code)


Cung cấp Stack
 MCU sử dụng stack trong

RAM SPACE
0x0800

RAM trong
 dsPIC® DSC sử dụng Stack
cho RAM ngoài
 C compiler sử dụng Stack

INT34 return addr
SUBR3 return addr

Parameter 1 = W0
Parameter 2 = W1
Parameter 3 = W2

 Return address

PC<15:1>

 Parameters

000000000

 Subroutine Variables

PC<22:16>

Frame Ptr of MyRoutine

 Temporary Storage

Temp Variable 1
Temp Variable 2
W15 -->
0xFFFE

Top Of Stack

0



New Addressing Modes
 Flexible addressing modes helps the C

compiler access data with minimum
overhead.

 Results - more compact code

ADD 0x500,WREG
ADD W4, W5, W6
ADD [W4], [W5], [W6]
ADD [W4++], [++W5], [W6--]
MOV [W4+W5], [W6]
ADD #500, W6

File Register (PIC18
Compatible)
Register
Direct
Register
Indirect
Register Indirect with Pre/Post
Inc/Dec
Register Indirect with
Offset
Litera
l


Xử lý ngắt


How fast can we Interrupt the code?


Dịch vụ ngắt nhanh
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

Reset - GOTO Instruction
Reset - GOTO Address
Reserved

0x000000
0x000002
0x000004

Oscillator Fail Trap
Address Error Trap
Stack Error Trap
Arithmetic Error Trap
Reserved

Higher
Priority
Interrupt

Reserved
Reserved

INT0 Vector
Capture 1 Vector
Compare 1 Vector
Timer 1 Vector
Capture 2 Vector
Compare 2 Vector


Interrupt 53 Vector

0x00007E


Chức năng
hỗ trợ phụ
System Management Features
make sure dsPIC ® DSC keeps dancing


Quản lý hệ thống
Chứ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

On Reset with a programmable delay 0,
♥4,Power
16, 64ms


♥Brown-out Reset with programmable levels


Clock sources
Low Pwr RC 512KHz
Fast RC 8.0 MHz
EC Clock

OSCI

XTL,XT,HS
Primary
Xtal OSC

PLL
4x,
8x,
16x
or bypass

Clock Divide
By
1, 4, 16, 64

System
Clock

OSCO
SOSCI
SOSCO


32KHz
Timer1 Xtal
OSC

Primary Oscillator for Crystals
32 kHz for Real Time Clock
 Includes 2 Internal RC Oscillators

PLL multiplies oscillator source
for high frequency operation
Clock divide can optionally
slow clock to conserve power


Kiể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
 uA Current

 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


Fail-Safe Operation
 Đảm bảo tính an toàn của hệ thống
 Clock monitor detects oscillator failure
 Automatic switch to an internal RC clock


 Software traps let software handle error

conditions





Oscillator Fail
Address out of range
Stack out of range
Math errors


×