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.

i2c_data_wait This is the timeout count for which the module has<br />

to wait before return.<br />

If the timeout count is ‘N’, the actual timeout would<br />

be about (20*N - 1) instruction cycles.<br />

Return Value Returns the number of bytes received from the I<br />

2<br />

Cbus.<br />

Remarks: This routine reads a predefined data string from the I<br />

2<br />

Cbus.<br />

Source File: SlavegetsI2C.c<br />

Code Example: unsigned char string[12];<br />

unsigned char *rdptr;<br />

rdptr = string;<br />

i2c_data_out = 0x11;<br />

SlavegetsI2C(rdptr, i2c_data_wait);<br />

OpenI2C (Continued)<br />

dsPIC Peripheral Libraries<br />

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

SlaveputsI2C<br />

Description: This function is used to write out a data string to the I<br />

2<br />

Cbus.<br />

Include: i2c.h<br />

Prototype: unsigned int SlaveputsI2C(unsigned char *wrptr);<br />

Arguments: wrptr Character type pointer to data objects in dsPIC ram. The<br />

data objects are written to the I<br />

2<br />

Cdevice.<br />

Return Value This function returns ‘0’ if the nullcharacter was reached in the<br />

data<br />

string.<br />

Remarks: This routine writes a data string out to the I<br />

2<br />

Cbus until a null character<br />

is reached.<br />

Source File: SlaveputsI2C.c<br />

Code Example: unsigned char string[] =”MICROCHIP”;<br />

unsigned char *rdptr;<br />

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

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

Bình luận: vĩ mô này xóa Thầy tôi<br />

2<br />

CInterrupt Enable chút ngắt Kích hoạt<br />

Kiểm soát đăng ký.<br />

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

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

2004 Microchip Technology Inc DS51456B trang 191<br />

SetPriorityIntMI2C<br />

Mô tả: Điều này đặt ra ưu tiên vĩ mô cho chủ tôi<br />

2<br />

Cinterrupt.<br />

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

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

Bình luận: vĩ mô này đặt Thầy tôi<br />

2<br />

CInterrupt bit ưu tiên của ưu tiên ngắt<br />

Kiểm soát đăng ký.<br />

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

EnableIntSI2C<br />

Mô tả: vĩ mô Điều này cho phép các nô lệ tôi<br />

2<br />

Cinterrupt.<br />

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

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

Bình luận: vĩ mô này đặt Slave tôi<br />

2<br />

Bit CEnable của Interrupt Enable kiểm soát<br />

đăng ký.<br />

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

DisableIntSI2C<br />

Mô tả: vĩ mô này vô hiệu hóa các nô lệ tôi<br />

2<br />

Cinterrupt.<br />

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

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

Bình luận: vĩ mô này xóa Slave tôi<br />

2

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

Saved successfully!

Ooh no, something went wrong!