30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DCI_FRAME_LEN_15<br />

DCI_FRAME_LEN_14<br />

.....<br />

DCI_FRAME_LEN_1<br />

DCI data word size<br />

DCI_DATA_WORD_16<br />

DCI_DATA_WORD_15<br />

DCI_DATA_WORD_14<br />

.....<br />

DCI_DATA_WORD_5<br />

DCI_DATA_WORD_4<br />

OpenDCI (Continued)<br />

dsPIC Peripheral Libraries<br />

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

config3 This contains the bit clock generator value to be<br />

configured in the DCICON3 register.<br />

trans_mask/ This contains the transmit/receive slot<br />

recv_mask Enable bits to be configured into the TSCON/<br />

RSCON register as defined below:<br />

DCI_DIS_SLOT_15<br />

DCI_DIS_SLOT_14<br />

.....<br />

DCI_DIS_SLOT_1<br />

DCI_DIS_SLOT_0<br />

DCI_EN_SLOT_ALL<br />

DCI_DIS_SLOT_ALL<br />

Return Value: None<br />

Remarks: This routine configures the following parameters:<br />

1. DCICON1 register:<br />

Enable bit,<br />

Frame Sync mode,<br />

Data Justification,<br />

Sample Clock Direction,<br />

Sample Clock,<br />

Edge Control,<br />

Output Frame Synchronization Directions Control,<br />

Continuous Transmit/Receive mode,<br />

Underflow mode.<br />

2. DCICON2 register:<br />

dsPIC Thư viện ngoại vi<br />

2004 Microchip Technology Inc DS51456B trang 155<br />

3.13.2 Macros cá nhân<br />

EnableIntDCI<br />

Mô tả: vĩ mô này cho phép ngắt DCI.<br />

Bao gồm: dci.h<br />

Lập luận: Không<br />

Bình luận: Đây bộ vĩ mô DCI ngắt Enablebit của ngắt Chức năng Kiểm soát<br />

đăng ký.<br />

Mã số Ví dụ: EnableIntDCI;<br />

DisableIntDCI<br />

Mô tả: vĩ mô này vô hiệu hóa ngắt DCI.<br />

Bao gồm: dci.h<br />

Lập luận: Không<br />

Bình luận: vĩ mô này sẽ xóa DCI Interrupt Enable bit Interrupt Enable kiểm soá<br />

đăng ký.<br />

Mã số Ví dụ: DisableIntDCI;<br />

SetPriorityIntDCI<br />

Mô tả: Đây ưu tiên bộ vĩ mô cho DCI bị gián đoạn.<br />

Bao gồm: dci.h<br />

Đối số: ưu tiên<br />

Bình luận: Đây bộ vĩ mô DCI ngắt bit ưu tiên của ngắt ưu tiên kiểm soát<br />

đăng ký.<br />

Mã số Ví dụ: SetPriorityIntDCI (4);<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 156 2004 Microchip Technology Inc<br />

3.13.3 Ví dụ sử dụng<br />

# xác định __dsPIC30F6014__<br />

# include<br />

# include<br />

/ * Dữ liệu nhận được lưu trữ từ 0x1820 trở đi. * /<br />

int * Receiveddata = (int *) 0x1820;<br />

khoảng trống __attribute __ ((__ interrupt__)) _DCIInterrupt (void)<br />

{<br />

IFS2bits.DCIIF = 0;<br />

}<br />

int main (void)

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

Saved successfully!

Ooh no, something went wrong!