| ??? 05/16/01 07:40 Read: times |
#11604 - RE: SPI bus implementation help please |
Hi Bill,
SPI on the 8051 was easy. Following a code example to send and receive 1 byte. Some changes can be needed depending from the device, which you want to control. You must read its data sheet. E.g. this example was used to control the AD7890. Additional chip select or strobe signals can be needed. E.g. the AD7890 need a chip select going low prior the 1. byte and going high after the last byte. Peter #include <reg51.h> sbit MISO = P1^0; sbit MOSI = P1^1; sbit SCK = P1^2; char spi_io( char d ) { char i; for( i = 8; i; i-- ){ SCK = 1; MOSI = d & 0x80; SCK = 0; d += d; if( MISO ) d++; } return d; } |
| Topic | Author | Date |
| SPI bus implementation help please | 01/01/70 00:00 | |
| RE: SPI bus implementation help please | 01/01/70 00:00 | |
| RE: SPI bus implementation help please | 01/01/70 00:00 | |
| RE: SPI bus implementation help please | 01/01/70 00:00 | |
| RE: SPI bus implementation help please | 01/01/70 00:00 | |
| RE: SPI bus implementation help please | 01/01/70 00:00 | |
RE: SPI bus implementation help please | 01/01/70 00:00 |



