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.

SetPriorityIntIC5<br />

SetPriorityIntIC6<br />

SetPriorityIntIC7<br />

SetPriorityIntIC8<br />

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

Include: outcompare.h<br />

Arguments: priority<br />

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

register.<br />

Code Example: SetPriorityIntOC4(0);<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

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

3.11.3 Example of Use<br />

#define __dsPIC30F6014__<br />

#include<br />

#include<br />

/* This is ISR corresponding to OC1 interrupt */<br />

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

{<br />

IFS0bits.OC1IF = 0;<br />

}<br />

int main(void)<br />

{<br />

/* Holds the value at which OCx Pin to be driven high */<br />

unsigned int pulse_start ;<br />

/* Holds the value at which OCx Pin to be driven low */<br />

unsigned int pulse_stop;<br />

/* Turn off OC1 module */<br />

CloseOC1();<br />

/* Configure output compare1 interrupt */<br />

ConfigIntOC1(OC_INT_OFF & OC_INT_PRIOR_5);<br />

/* Configure OC1 module for required pulse width */<br />

pulse_start = 0x40;<br />

pulse_stop = 0x60;<br />

PR3 = 0x80 ;<br />

PR1 = 0xffff;<br />

TMR1 = 0x0000;<br />

DS51456B trang 142<br />

ConfigIntUART1<br />

ConfigIntUART2<br />

2004 Microchip Technology Inc<br />

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

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

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

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

Lập luận: config cá nhân gián đoạn bật / tắt thông tin theo quy định<br />

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

Nhận ngắt cho phép<br />

UART_RX_INT_EN<br />

UART_RX_INT_DIS<br />

Nhận ưu tiên ngắt<br />

UART_RX_INT_PR0<br />

UART_RX_INT_PR1<br />

UART_RX_INT_PR2<br />

UART_RX_INT_PR3<br />

UART_RX_INT_PR4<br />

UART_RX_INT_PR5<br />

UART_RX_INT_PR6<br />

UART_RX_INT_PR7<br />

Truyền gián đoạn cho phép<br />

UART_TX_INT_EN<br />

UART_TX_INT_DIS<br />

Truyền ưu tiên ngắt<br />

UART_TX_INT_PR0<br />

UART_TX_INT_PR1<br />

UART_TX_INT_PR2<br />

UART_TX_INT_PR3<br />

UART_TX_INT_PR4<br />

UART_TX_INT_PR5<br />

UART_TX_INT_PR6<br />

UART_TX_INT_PR7<br />

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

Ghi chú: Chức năng này cho phép / vô hiệu hóa các UART truyền và nhận<br />

ngắt và thiết lập các ưu tiên ngắt.<br />

Source File: ConfigIntUART1.c<br />

ConfigIntUART2.c<br />

Mã số Ví dụ: ConfigIntUART1 (UART_RX_INT_EN & UART_RX_INT_PR5<br />

&

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

Saved successfully!

Ooh no, something went wrong!