User manual

347 C-Control Pro IDE
© 2013 Conrad Electronic
5.23.1.2
SPI_Enable
SPI Funktionen
Syntax
void SPI_Enable(byte ctrl);
Sub SPI_Enable(ctrl As Byte)
Beschreibung
Die SPI Schnittstelle wird mit dem Wert von ctrl initialisiert (siehe SPCR Register in Atmel Mega Reference
Manual).
Parameter
ctrl Initialisierungsparameter (Mega SPCR Register)
Bit 7 - SPI Interrupt Enable (nicht einschalten, kann von C-Control Pro nicht genutzt werden)
Bit 6 - SPI Enable (muss gesetzt sein)
Bit 5 - Data Order (1 = LSB first, 0 = MSB first)
Bit 4 - Master/Slave Select (1 = Master, 0 = Slave)
Bit 3 - Clock polarity (1 = leading edge falling, 0 = leading edge rising)
Bit 2 - Clock Phase (1 = sample on trailing edge, 0 = sample on leading edge)
Bit 1
Bit 0
SCK Frequency
0
0
f
Osc
/ 4
0
1
f
Osc
/ 16
1
0
f
Osc
/ 64
1
1
f
Osc
/ 128
Es ist zu beachten, das bei C-Control Pro Mega 32 und Mega128 f
Osc
= 14,7456 Mhz ist, wäh-
rend die C-Control Pro Mega128 CAN mit 16 Mhz arbeitet.
5.23.1.3 SPI_Read
SPI Funktionen
Syntax
byte SPI_Read();
Sub SPI_Read() As Byte
Beschreibung
Ein Byte wird von der SPI Schnittstelle gelesen.
Rückgabewert