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.

Code Example: DisableIntDCI;<br />

SetPriorityIntDCI<br />

Description: This macro sets priority for DCI interrupt.<br />

Include: dci.h<br />

Arguments: priority<br />

Remarks: This macro sets DCI Interrupt Priority bits of Interrupt Priority<br />

Control<br />

register.<br />

Code Example: SetPriorityIntDCI(4);<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

Mô tả: Chức năng này cấu hình SPI ngắt.<br />

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

Prototype: void ConfigIntSPI1 (int config);<br />

làm mất hiệu lực ConfigIntSPI2 (int config);<br />

Đối số: cấu hình SPI ngắt ưu tiên và bật / tắt thông tin<br />

quy định dưới đây:<br />

Ngắt bật / tắt<br />

SPI_INT_EN<br />

SPI_INT_DIS<br />

Ưu tiên ngắt<br />

SPI_INT_PRI_0<br />

SPI_INT_PRI_1<br />

DS51456B-page 156<br />

3.13.3 Example of Use<br />

2004 Microchip Technology Inc.<br />

SPI_INT_PRI_2<br />

SPI_INT_PRI_3<br />

#define __dsPIC30F6014__<br />

#include<br />

#include<br />

/* Received data is stored from 0x1820 onwards. */<br />

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

void __attribute__((__interrupt__)) _DCIInterrupt(void)<br />

{<br />

IFS2bits.DCIIF = 0;<br />

}<br />

int main(void)<br />

{<br />

/* Data to be transmitted using DCI module */<br />

unsigned int data16[] = {0xabcd, 0x1234, 0x1578,<br />

0xfff0, 0xf679};<br />

/* Holds configuration information */<br />

unsigned int DCICON1value;<br />

/* Holds the value of framelength, wordsize and buffer length */<br />

unsigned int DCICON2value;<br />

/* Holds the information reagarding bit clock<br />

generator */<br />

unsigned int DCICON3value ;<br />

/* Holds the information reagarding data tobe received<br />

or ignored during this time slot */<br />

unsigned int RSCONvalue ;<br />

/* Holds the information reagarding transmit buffer<br />

SPI_INT_PRI_4<br />

SPI_INT_PRI_5<br />

SPI_INT_PRI_6<br />

SPI_INT_PRI_7<br />

Trở lại giá trị: Không<br />

Ghi chú: Chức năng này sẽ xóa sạch các bit Cờ ngắt, đặt ưu tiên ngắt và<br />

cho phép / vô hiệu hóa ngắt.<br />

Source File: ConfigIntSPI1.c<br />

ConfigIntSPI2.c<br />

Mã số Ví dụ: ConfigIntSPI1 (SPI_INT_PRI_3 & SPI_INT_EN);<br />

CloseSPI1<br />

CloseSPI2<br />

Mô tả: Chức năng này sẽ tắt các mô-đun SPI<br />

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

Prototype: void CloseSPI1 (void);<br />

làm mất hiệu lực CloseSPI2 (void);<br />

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

Trở lại giá trị: Không<br />

Ghi chú: Chức năng này vô hiệu hóa ngắt SPI và sau đó tắt các mô-đun.<br />

Các bit Cờ ngắt cũng sẽ bị xóa.<br />

Source File: CloseSPI1.c<br />

CloseSPI2.c<br />

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

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

2004 Microchip Technology Inc DS51456B trang 159

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

Saved successfully!

Ooh no, something went wrong!