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.

MPLAB ® <strong>C18</strong> C 编 译 器 函 数 库void ew_enable(void){W_CS = 1;//assert chip selectputcMwire(EWEN1); //enable write command byte 1putcMwire(EWEN2); //enable write command byte 2W_CS = 0;//negate chip select}void busy_poll(void){W_CS = 1;while(! DataRdyMwire() );W_CS = 0;}void write_byte(unsigned char address,unsigned char data){W_CS = 1;putcMwire(WRITE); //write commandputcMwire(address); //addressputcMwire(data); //write single byteW_CS = 0;}void byte_read(unsigned char address){W_CS = 1;getcMwire(READ,address); //read one byteW_CS = 0;}void read_mult(unsigned char address,unsigned char *rdptr,unsigned char length){W_CS = 1;putcMwire(READ);//read commandputcMwire(address); //address (A7 - A0)getsMwire(rdptr, length); //read multiple bytesW_CS = 0;}void erase_all(void){W_CS = 1;putcMwire(ERAL1); //erase all command byte 1putcMwire(ERAL2); //erase all command byte 2W_CS = 0;}DS51297C_CN 第 38 页© 2004 Microchip Technology Inc.

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

Saved successfully!

Ooh no, something went wrong!