C8051F SPI程序

来自丢石头百科
Admin讨论 | 贡献2019年11月18日 (一) 16:37的版本 (/********************************************************************************************************** File : ws_spi_port.h* Hardware Environment:* Build Environment : Silicon LABs 3.42.00 / uVis ...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)


/********************************************************************************************************

  • File : ws_spi_port.h
  • Hardware Environment: 
  • Build Environment : Silicon LABs 3.42.00 / uVision3 V3.80 20100913
  • Version : 
  • By : Su Wei Feng
  •                                                           (c) Copyright 2005-2010, WaveShare
  •                                                                      <a class="Blue_2_12px_" href="http://www.waveshare.net/" style="color: rgb(7, 66, 184);" target="_blank">http://www.waveshare.net
  •                                                                          All Rights Reserved
                                                                                                                                                                                                                  • /
  1. ifndef _WS_SPI_PORT_H_
  2. define _WS_SPI_PORT_H_

void spiSendChar(uchar send_char);

/*Hardware Environment:DVK501 && F320 EX*/

  1. if defined(_DVK501_F320_EX_)

sbit CS_LCD = P0^7; void SPI_Init(void) {  XBR0 |= 0x03; P0SKIP |= 0x80; P0MDOUT |= 0xC1; SPI0CFG = 0x40; SPI0CN = 0x01; SPI0CKR = 0x05; }

  1. else
  2. warning "No SPI!"
  3. endif
  4. include <../../../../library/C8051F/ws_spi.h>
  5. endif /*_WS_SPI_PORT_H_*/

  /********************************************************************************************************

  • File : ws_spi.h
  • Hardware Environment: 
  • Build Environment : Silicon LABs 3.42.00 / uVision3 V3.80 20100913
  • Version : 
  • By : Su Wei Feng
  •                                                           (c) Copyright 2005-2010, WaveShare
  •                                                                      <a class="Blue_2_12px_" href="http://www.waveshare.net/" style="color: rgb(7, 66, 184);" target="_blank">http://www.waveshare.net
  •                                                                          All Rights Reserved
                                                                                                                                                                                                                  • /
  1. ifndef _WS_SPI_H_
  2. define _WS_SPI_H_

void spiSendChar(uchar send_char) { SPIF = 0; SPI0DAT = send_char; while (!SPIF); }

  1. endif /*_WS_SPI_H_*/