Philips Semiconductors
AN10369
Philips ARM LPC microcontroller family
Fig 2. Code output
3. SPI
The following code sample configures the SPI as a master and transmits data bytes on
the MOSI pin. Output waveforms are captured on the oscilloscope and shown below.
Since no slave device is physically connected to the master, SSEL should be driven high
(does not apply to the LPC213x family). MISO is not being used in this example. Also the
VPB clock is set to system clock (10MHz) and SPI is run at maximum speed
(SPCCR=0x8). CPOL and CPHA both are set to 0.
3.1 Speed Calculation
Speed of SPI= VPB clock/ SPCCR value= 10MHz/8= 1.25 MHz.
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
Application note
Rev. 01 — 06 April 2005
6 of 17
3.2 C Code
/* Include header file depending upon part used */
#include"LPC2….h"
void Initialize(void);
/* Macro Definitions */
#define SPIF (1<<7)
#define DATA 0xC1
/************************* MAIN *************************/
int main()