30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DSP Library<br />

2004 Microchip Technology Inc. DS51456B-page 39<br />

2.6.3 Single Sample Filtering<br />

The filtering functions provided in the DSP Library are designed for block<br />

processing.<br />

Each filter function accepts an argument named numSampswhich indicates the<br />

number of words of input data (block size) to operate on. If single sample<br />

filtering is desired,<br />

you may set numSampsto 1. This will have the effect of filtering one input<br />

sample, and<br />

the function will compute a singleoutput sample from the filter.<br />

2.6.4 User Considerations<br />

All the fractional filtering operations in this library rely on the values of either<br />

input<br />

parameters or data structure elements to specify the number of samples to<br />

process,<br />

and the sizes of the coefficients and delay vectors. Based on these values the<br />

following<br />

assumptions are made:<br />

a) The sum of sizes of all the vectors (sample sequences) involved in a<br />

particular<br />

operation falls within the range of available data memory for the target device.<br />

b) The destination vector mustbe large enough to accept the results of an<br />

operation.<br />

c) No boundary checking is performed by these functions. Out of range sizes<br />

(including zero length vectors) as well as nonconforming use of source vectors<br />

and coefficient sets may produce unexpected results.<br />

d) It is recommended that the Status register (SR) is examined after completion<br />

of<br />

each function call. In particular, users can inspect the SA, SB and SAB flags<br />

after<br />

the function returns to determine if saturation occurred.<br />

e) Operations which return a destination vector can be nested, so that for<br />

instance<br />

if:<br />

a = Op1 (b, c), with b = Op2 (d), and c = Op3 (e, f), then<br />

a = Op1 (Op2 (d), Op3 (e, f))<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 40<br />

2.6.5 Individual Functions<br />

2004 Microchip Technology Inc.<br />

In what follows, the individual functions implementing filtering operations are<br />

described. For further discussions on digital filters, please consult Alan<br />

delayBase địa chỉ cơ sở cho sự chậm trễ đệm<br />

địa chỉ kết thúc delayEnd cho sự chậm trễ đệm<br />

trì hoãn giá trị hiện tại của con trỏ chậm trễ (cũng d)<br />

Bình luận: Số lượng các hệ số trong bộ lọc là M.<br />

Hệ số, h [m], được định nghĩa trong 0 ≤m<br />

bộ nhớ.<br />

Chậm trễ đệm d [m], được định nghĩa trong 0 ≤m<br />

Nếu hệ số được lưu trữ trong không gian X-Data, coeffsBasepoints đến<br />

địa chỉ thực tế mà hệ số được phân bổ. Nếu hệ số là<br />

lưu trữ trong bộ nhớ chương trình, coeffsBaseis bù đắp từ chương trình<br />

trang ranh giới có chứa các hệ số địa chỉ trong trang<br />

nơi mà hệ số được phân bổ. Giá trị sau này có thể được tính toán<br />

bằng cách sử dụng psvoffset hành lắp ráp nội tuyến ().<br />

coeffsEndis địa chỉ trong không gian X-Data (hoặc bù đắp nếu trong chương<br />

trình<br />

bộ nhớ) của byte cuối cùng của bộ đệm hệ số bộ lọc.<br />

Nếu hệ số được lưu trữ trong không gian X-Data, coeffsPagemust được thiết lập<br />

để<br />

0xff00 (được định nghĩa COEFFS_IN_DATA giá trị). Nếu hệ số được lưu trữ<br />

trong<br />

bộ nhớ chương trình, nó là số trang chương trình có chứa các hệ số. Giá trị sau<br />

này có thể được tính toán bằng cách sử dụng lắp ráp nội tuyến<br />

điều hành psvpage ().<br />

delayBasepoints đến địa chỉ thực tế nơi mà các bộ đệm chậm trễ được phân bổ.<br />

delayEndis địa chỉ của người cuối cùng byteof bộ đệm chậm trễ lọc.<br />

DSP Thư viện<br />

2004 Microchip Technology Inc DS51456B trang 41<br />

Khi các hệ số và bộ đệm chậm trễ được thực hiện như tròn<br />

tăng bộ đệm modulo, cả coeffsBaseand<br />

delayBase mustbe liên kết đến một quyền lực 'không' của hai địa chỉ<br />

(coeffsEndand delayEndare địa chỉ lẻ). Cho dù các bộ đệm<br />

thực hiện như bộ đệm tròn tăng modulo hoặc không được chỉ định trong<br />

phần nhận xét của mỗi bộ lọc FIR mô tả chức năng.<br />

Khi các hệ số và bộ đệm chậm trễ không được thực hiện như tròn (tăng) theo<br />

modulo bộ đệm, coeffsBaseand<br />

delayBase không cần tobe liên kết quyền lực một 'không' của hai địa chỉ,<br />

và các giá trị của coeffsEndand delayEndare bỏ qua trong<br />

đặc biệt FIR Bộ lọc chức năng thực hiện.<br />

FIR<br />

Mô tả: FIRapplies một bộ lọc FIR với chuỗi các mẫu nguồn, đặt<br />

kết quả trong các mẫu đến sequenceof, và cập nhật sự chậm trễ<br />

giá trị.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!