×
单片机 > 单片机程序设计 > 详情

C8051F SPI程序

发布时间:2021-11-09 发布时间:
|

摘要: /********************************************************************************************************** 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

* /zixunimg/eeworldimg/www.waveshare.net

* All Rights Reserved

*

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


#ifndef _WS_SPI_PORT_H_

#define _WS_SPI_PORT_H_


void spiSendChar(uchar send_char);


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

#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;

}


#else

#warning "No SPI!"

#endif


#include <..>


#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

* /zixunimg/eeworldimg/www.waveshare.net

* All Rights Reserved

*

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


#ifndef _WS_SPI_H_

#define _WS_SPI_H_


void spiSendChar(uchar send_char)

{

SPIF = 0;

SPI0DAT = send_char;

while (!SPIF);

}


#endif /*_WS_SPI_H_*/



『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
STM32中断向量表的位置.重定向