LPC2368

LPC2368 SSP init as SPI

void sspInit(void) { // SSP1 (SPI) init sequense PCONP |= (1<<10); // PCSSP1 - power on PINSEL0 |= (2<<(7*2)) | (2<<(8*2)) | (2<<(9*2)) | (2<<(6*2)); // configure SPI1 pinouts // Serial Clock Rate: PCLK/CPSDVSR SSP1CR1 = 0x0 ; // disable SSP, must be off during changes SSP1CR0 = (8-1); // | (1<<6) /* CPOL */ | (1<<7) /* CPHA */; // | SSP_CR0_CPOL | SSP_CR0_CPHA; // DataSizeSelect=8, CPOL=1,CPHA=1 SSP1CPSR = 8; // SPICLK = PCLK/8 = 18MHz/8 = 2.

LPC2368 UART init

void uartInit(unsigned long baudrate) { /*------------------------------------------------ Setup serial port registers. ------------------------------------------------*/ PCONP |= (1<<3); // PCUART0 UART0 power/clock control bit. PINSEL0 |= (1<<(2*2)) | (1<<(2*3)); /* Enable TXD0, RXD0 */ U0LCR = 0x03; /* 8 bits, no Parity, 1 Stop bit */ U0IER = 0; /* Disable UART1 Interrupts */ U0FCR = 0x07; unsigned long DLreload; DLreload = ((Fpclk / 16UL) + (baudrate-1)) / baudrate; U0LCR |= 0x80; /* Set DLAB */ U0DLL = DLreload; U0DLM = (DLreload >> 8); U0LCR &= ~0x80; /* Clear DLAB */ } char uartGetc(void) { while (!