Slide 1 Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 Slide 8 Slide 9 Slide 10 Slide 11 Slide 12 Slide 13 Slide 14 Slide 15 Slide 16 Slide 17 Slide 18 Slide 19 Slide 20 Slide 21 Slide 22 Slide 23 Product List
Initializing UART

Here is a code segment to initialize the UART0 peripheral. It uses Timer 1 to generate the baud rate at 57,600 using the 8-bit auto reload mode. The reload value is stored in TH1, and that value is also used to initialize the timer register itself so that the first count sequence is the correct length. The CKCON register sets the clock source for the timer to be the system clock at 24.500000Hz and the SCON register enables the receiver and sets the UART mode to 8-bit.

PTM Published on: 2011-02-07