AnsweredAssumed Answered

Uart 2

Question asked by Icarus on Jun 3, 2010
Latest reply on Jul 19, 2010 by ting.chen_hanson
Hi there,

I spent the entire day yesterday trying yet again to get the sample code (UM0884) to compile. For some reason I am struggling to understand the code that has been written as a worked example, there seems to be way too many header files and source files required just to turn on the RS232 Serial Comms...

In the past everytime I wanted to use the serial comms on processors such as the PIC, Motorola, NEC, Atmel the process was fairly simple and straightforward and could be made to work in an hour or so, after some tweaking of the baud rate etc...

Do I need to use all the headerfiles and source files to get basic comms up and running or can I directly turn on the Uart 2 directly?

Basically what I am asking is can I do it like this?

void UART2_Init (void)
 UART2_CR1 = 0x02;      // 1 start bit, 8 data, odd parity
 UART2_CR3 = 0x20;      // 2 Stop Bits
 UART2_BRR2 = 0x02;   // Baud Rate
 UART2_BRR1 = 0x68;   // Baud Rate
 UART2_CR2 = 0x80;     // Set TEN bit to Enable Transmitter Mode
// set a flag to watch for TC to be set to 1 in UART_SR

As this is how I always used to initialise the Serial Comms, can I still do it this way?

I understand to talk out other commands are required, but I already understand how that should be done...