12.07.2015 Views

MPLAB® C18 C 编译器函数库

MPLAB® C18 C 编译器函数库

MPLAB® C18 C 编译器函数库

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

硬 件 外 设 函 数unsigned char status_read (void){SPI_CS = 0;//assert chip selectvar = putcSPI(SPI_RDSR); //send read status commandvar = getcSPI();//read data byteSPI_CS = 1;//negate chip selectreturn (var);}void status_write (unsigned char data){SPI_CS = 0;var = putcSPI(SPI_WRSR); //write status commandvar = putcSPI(data); //status byte to writeSPI_CS = 1;//negate chip select}void busy_polling (void){do{SPI_CS = 0;//assert chip selectvar = putcSPI(SPI_RDSR); //send read status commandvar = getcSPI();//read data byteSPI_CS = 1;//negate chip select} while (var & 0x01); //stay in loop until !busy}© 2004 Microchip Technology Inc. DS51297C_CN 第 47 页

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

Saved successfully!

Ooh no, something went wrong!