![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test
Fork of HelloWorld by
Diff: main.cpp
- Revision:
- 21:74482f23c8fe
- Parent:
- 20:107380f7eeb9
- Child:
- 22:706708bc4c1a
--- a/main.cpp Thu Aug 31 19:47:15 2017 +0000 +++ b/main.cpp Fri Sep 01 17:41:34 2017 +0000 @@ -9,6 +9,46 @@ int main() { + + // Power up the UART3 it's disabled on powerup. + LPC_SC->PCONP |= (1UL << 25); + + // Setup the PCLK for UART3 + // LPC_SC->PCLKSEL1 &= ~(3UL << 18); // Clean + LPC_SC->PCLKSEL1 |= (1UL << 18); // PCLK = CCLK + + // Setup the baud rate for 9600 + LPC_UART3->LCR = 0x80; // LPC_UART3->LCR |= (1UL << 7); + LPC_UART3->DLM = 0x2; + LPC_UART3->DLL = 0x71; + LPC_UART3->LCR = 0x3; // 8-bit character length + + // Enable the pins on the device to use UART3 + LPC_PINCON->PINSEL0 |= (3UL << 18); + LPC_PINCON->PINSEL0 |= (3UL << 20); + + // Enable and reset UART3 FIFOs. + LPC_UART3->FCR = 0x7; + + // Enable the interrupt + NVIC_EnableIRQ(UART3_IRQn); + + // Init the UART3 RX interrupt + LPC_UART3->IER = 0x01; + + LPC_UART3->LCR &= ~(1UL << 7); + + LPC_UART3->THR = 7; + + /* + while(LPC_UART3->THRE = 0) + { + + } + */ + + + /* float x, y, z ; MMA8452Q acc(p9,p10,0x1d); // acceleration object @@ -76,9 +116,17 @@ cs = 1; wait(0.1); } + */ } + + + + + + + /* communication SPI Serial pc(USBTX, USBRX); // tx, rx SPI acc(p11,p12,p13);