文件名称:ffsp
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 37kb
- 下载次数:
- 0次
- 提 供 者:
- dddddd******
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
SPI lib for atmega168. DON USE Wrk? UNOS
void spi_init(void)
{
/* Set MOSI and SCK output */
DDR_SPI |= _BV(DD_MOSI) | _BV(DD_SCK)
DDR_SPI &= ~_BV(DD_MISO)
/* Enable SPI, Master, set clock rate fck/128 */
SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0) | _BV(SPR1)
SPSR = _BV(SPI2X)
}
uint8_t spi_send_receive_byte(uint8_t byte)
{
/* Start transmission */
SPDR = byte
/* Wait for transmission complete */
while (!(SPSR & _BV(SPIF)))
/* Read the received byte */
byte = SPDR
return byte
}-SPI lib for atmega168. DON USE Wrk? UNOS
void spi_init(void)
{
/* Set MOSI and SCK output */
DDR_SPI |= _BV(DD_MOSI) | _BV(DD_SCK)
DDR_SPI &= ~_BV(DD_MISO)
/* Enable SPI, Master, set clock rate fck/128 */
SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0) | _BV(SPR1)
SPSR = _BV(SPI2X)
}
uint8_t spi_send_receive_byte(uint8_t byte)
{
/* Start transmission */
SPDR = byte
/* Wait for transmission complete */
while (!(SPSR & _BV(SPIF)))
/* Read the received byte */
byte = SPDR
return byte
}
void spi_init(void)
{
/* Set MOSI and SCK output */
DDR_SPI |= _BV(DD_MOSI) | _BV(DD_SCK)
DDR_SPI &= ~_BV(DD_MISO)
/* Enable SPI, Master, set clock rate fck/128 */
SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0) | _BV(SPR1)
SPSR = _BV(SPI2X)
}
uint8_t spi_send_receive_byte(uint8_t byte)
{
/* Start transmission */
SPDR = byte
/* Wait for transmission complete */
while (!(SPSR & _BV(SPIF)))
/* Read the received byte */
byte = SPDR
return byte
}-SPI lib for atmega168. DON USE Wrk? UNOS
void spi_init(void)
{
/* Set MOSI and SCK output */
DDR_SPI |= _BV(DD_MOSI) | _BV(DD_SCK)
DDR_SPI &= ~_BV(DD_MISO)
/* Enable SPI, Master, set clock rate fck/128 */
SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0) | _BV(SPR1)
SPSR = _BV(SPI2X)
}
uint8_t spi_send_receive_byte(uint8_t byte)
{
/* Start transmission */
SPDR = byte
/* Wait for transmission complete */
while (!(SPSR & _BV(SPIF)))
/* Read the received byte */
byte = SPDR
return byte
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ffsp
....\DLib_Product.h
....\DLib_Threads.h
....\errno.h
....\exception
....\ff.h
....\float.h
....\fstream
....\fstream.h
....\functional
....\hash_map
....\hash_set
....\ichooser
....\inttypes.h
....\iomanip
....\iomanip.h
....\ios
....\iosfwd
....\iostream
....\iostream.h
....\iso646.h
....\istream
....\iterator
....\spi168.h
....\DLib_Product.h
....\DLib_Threads.h
....\errno.h
....\exception
....\ff.h
....\float.h
....\fstream
....\fstream.h
....\functional
....\hash_map
....\hash_set
....\ichooser
....\inttypes.h
....\iomanip
....\iomanip.h
....\ios
....\iosfwd
....\iostream
....\iostream.h
....\iso646.h
....\istream
....\iterator
....\spi168.h