void UARTInit(uint32_t baudrate)
{
...
LPC_SYSCON->UARTCLKDIV = [color=#f00]100[/color]; /* divided by 1 */
...
/*****************************************************************************
* uarttest.c: UART test C file for NXP LPC13xx Family Microprocessors
*
* Copyright(C) 2008, NXP Semiconductor
* All rights reserved.
*
* History
* 2008.08.20 ver 1.00 Preliminary version, first Release
*
******************************************************************************/
#include "LPC13xx.h"
#include "uart.h"
extern volatile uint32_t UARTCount;
extern volatile uint8_t UARTBuffer[BUFSIZE];
int main (void) {
volatile uint32_t i;
/* Basic chip initialization is taken care of in SystemInit() called
* from the startup code. SystemInit() and chip settings are defined
* in the CMSIS system_<part family>.c file.
*/
/* NVIC is installed inside UARTInit file. */
UARTInit(1); //set 1 bps, LED is showing each bit 1 second!!!!
UARTBuffer[0]= 0b01010101;//byte to blink
while (1)
{/* Loop forever */
i++;
if(i>10E6)
{
i =0;
UARTSend( (uint8_t *)UARTBuffer,1);
}
}
}
|
/*****************************************************************************
* uarttest.c: UART test C file for NXP LPC13xx Family Microprocessors
*
* Copyright(C) 2008, NXP Semiconductor
* All rights reserved.
*
* History
* 2008.08.20 ver 1.00 Preliminary version, first Release
*
******************************************************************************/
#include "LPC13xx.h"
#include "uart.h"
extern volatile uint32_t UARTCount;
extern volatile uint8_t UARTBuffer[BUFSIZE];
int main (void) {
volatile uint32_t i;
/* Basic chip initialization is taken care of in SystemInit() called
* from the startup code. SystemInit() and chip settings are defined
* in the CMSIS system_<part family>.c file.
*/
/* NVIC is installed inside UARTInit file. */
UARTInit(70);//70bps, UART isn't working lower
UARTBuffer[0]= 0x0;
while (1)
{/* Loop forever */
i++;
if(i>1E6)
{
i =0;
UARTSend( (uint8_t *)UARTBuffer,1);
}
}
}
|