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.

Prototype: void WriteSPI1(unsigned int data);<br />

void WriteSPI2(unsigned int data);<br />

Arguments: data This is the data to be transmitted which will be stored in SPI<br />

buffer.<br />

Remarks: This function writes the data (byte/word) to be transmitted into the<br />

transmit buffer.<br />

If 16-bit communication is enabled,the 16-bit value is written to the<br />

transmit buffer.<br />

If 8-bit communication is enabled, then upper byte is masked and then<br />

written to the transmit buffer.<br />

Return Value: None<br />

Source File: WriteSPI1.c<br />

WriteSPI2.c<br />

Code Example: WriteSPI1(0x3FFF);<br />

OpenSPI1<br />

OpenSPI2<br />

Description: This function configures the SPI module<br />

Include: spi.h<br />

Prototype: void OpenSPI1(unsigned int config1,<br />

unsigned int config2);<br />

void OpenSPI2(unsigned int config1,<br />

unsigned int config2);<br />

Arguments: config1 This contains the parameters to be configured in the<br />

SPIxCON register as defined below:<br />

Framed SPI support Enable/Disable<br />

FRAME_ENABLE_ON<br />

FRAME_ENABLE_OFF<br />

Frame Sync Pulse direction control<br />

FRAME_SYNC_INPUT<br />

FRAME_SYNC_OUTPUT<br />

SDO Pin Control bit<br />

DISABLE_SDO_PIN<br />

ENABLE_SDO_PIN<br />

Word/Byte Communication mode<br />

SPI_MODE16_ON<br />

SPI_MODE16_OFF<br />

SPI Data Input Sample phase<br />

SPI_SMP_ON<br />

SPI_SMP_OFF<br />

Mô tả: Chức năng này ghi một chuỗi các dữ liệu được truyền vào SPI<br />

truyền đệm.<br />

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

Nguyên mẫu:<br />

làm mất hiệu lực putsSPI1 (unsigned int dài,<br />

int * wrptr);<br />

làm mất hiệu lực putsSPI2 (unsigned int dài,<br />

int * wrptr);<br />

Đối số: chiều dài Đây là số từ dữ liệu / byte được truyền đi.<br />

wrptr Đây là con trỏ đến chuỗi dữ liệu được truyền đi.<br />

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

Ghi chú: Chức năng này ghi chiều dài xác định các từ dữ liệu / byte được<br />

truyền vào bộ đệm truyền.<br />

Một khi bộ đệm truyền đầy, nó chờ đợi cho đến khi dữ liệu được truyền và<br />

sau đó ghi dữ liệu tiếp theo vào sổ đăng ký Transmit.<br />

Việc kiểm soát vẫn còn trong functionif SPI mô-đun isdisabled trong khi điều<br />

này<br />

SPITBF bit được thiết lập.<br />

Source File: putsSPI1.c<br />

putsSPI2.c<br />

Mã số Ví dụ: putsSPI1 (10, Txdata_loc);<br />

getsSPI1<br />

getsSPI2<br />

Mô tả: Chức năng này lần đọc một chuỗi các dữ liệu chiều dài quy định và lưu<br />

trữ nó vào<br />

vị trí quy định.<br />

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

Nguyên mẫu: int getsSPI1 (<br />

chiều dài int unsigned,<br />

int * rdptr,<br />

int spi_data_wait);<br />

int getsSPI2 (<br />

chiều dài int unsigned,<br />

int * rdptr,<br />

int spi_data_wait);<br />

Đối số: chiều dài Đây là chiều dài của chuỗi được nhận.<br />

rdptr Đây là con trỏ đến vị trí dữ liệu<br />

nhận phải được lưu trữ.<br />

spi_data_wait Đây là số thời gian chờ cho các mô-đun<br />

đã phải chờ đợi trước khi trở về.

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

Saved successfully!

Ooh no, something went wrong!