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.

module is not in PWM mode.<br />

Include: outcompare.h<br />

Prototype: unsigned int ReadRegOC1(char reg);<br />

unsigned int ReadRegOC2(char reg);<br />

unsigned int ReadRegOC3(char reg);<br />

unsigned int ReadRegOC4(char reg);<br />

unsigned int ReadRegOC5(char reg);<br />

unsigned int ReadRegOC6(char reg);<br />

unsigned int ReadRegOC7(char reg);<br />

unsigned int ReadRegOC8(char reg);<br />

Arguments:<br />

reg This indicates if the read should happen from the main or<br />

secondary duty cycle registers of Output Compare module.<br />

If regis ‘1’, then the contents of Main Duty Cycle register<br />

(OCxR) is read.<br />

If regis ‘0’, then the contents of Secondary Duty Cycle register<br />

(OCxRS) is read.<br />

Return Value: If regis ‘1’, then the contents of Main Duty Cycle register<br />

(OCxR) is<br />

read.<br />

If regis ‘0’, then the contents of Secondary Duty Cycle register<br />

(OCxRS) is read.<br />

If Output Compare module is in PWM mode, ‘-1’ is returned.<br />

Remarks: The read of Duty Cycle registerhappens only when Output Compare<br />

module is not in PWM mode. Else, a value of ‘-1’ is returned.<br />

Source File: ReadRegOC1.c<br />

ReadRegOC2.c<br />

ReadRegOC3.c<br />

ReadRegOC4.c<br />

ReadRegOC5.c<br />

ReadRegOC6.c<br />

ReadRegOC7.c<br />

ReadRegOC8.c<br />

Code Example: unsigned int dutycycle_reg;<br />

dutycycle_reg = ReadRegOC1(1);<br />

dsPIC Peripheral Libraries<br />

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

SetDCOC1PWM<br />

SetDCOC2PWM<br />

khoảng trống SetPulseOC4 (int pulse_start,<br />

int pulse_stop);<br />

khoảng trống SetPulseOC5 (int pulse_start,<br />

int pulse_stop);<br />

khoảng trống SetPulseOC6 (int pulse_start,<br />

int pulse_stop);<br />

khoảng trống SetPulseOC7 (int pulse_start,<br />

int pulse_stop);<br />

khoảng trống SetPulseOC8 (int pulse_start,<br />

int pulse_stop);<br />

Đối số: pulse_start này là giá trị được lưu trữ vào đầu ra so sánh<br />

Đăng ký chính (OCxR).<br />

pulse_stop Đây là giá trị được lưu trữ vào đầu ra so sánh<br />

Đăng ký thứ cấp (OCxRS).<br />

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

Chú ý: Đầu ra so sánh đăng ký nhiệm vụ chu kỳ (OCxR và OCxRS) sẽ<br />

cấu hình với giá trị mới mô-đun chỉ ifthe không ở chế độ PWM.<br />

Source File: SetPulseOC1.c<br />

SetPulseOC2.c<br />

SetPulseOC3.c<br />

SetPulseOC4.c<br />

SetPulseOC5.c<br />

SetPulseOC6.c<br />

SetPulseOC7.c<br />

SetPulseOC8.c<br />

Mã số Ví dụ: pulse_start = 0x40;<br />

pulse_stop = 0x60;<br />

SetPulseOC1 (pulse_start, pulse_stop);<br />

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

2004 Microchip Technology Inc DS51456B trang 139<br />

3.11.2 Macros cá nhân<br />

EnableIntOC1<br />

EnableIntOC2<br />

EnableIntOC3<br />

EnableIntOC4<br />

EnableIntOC5<br />

EnableIntOC6<br />

EnableIntOC7<br />

EnableIntOC8

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

Saved successfully!

Ooh no, something went wrong!