void init_serial (void) { /* Initialize Serial Interface */
PINSEL0 = PINSEL0 | 0X00000005; /* Enable RxD0 and TxD0 */
U0LCR = 0X83; /*8 bits, no Parity, 1 Stop bit */
U0DLL = 0XC3;
U0DLM = 0X00; /* 9600bps baud rate */
U0LCR = 0X03; /* DLAB = 0 */
}
FOSC: the frequency from the crystal oscillator/external oscillator
FCCO: the frequency of the PLL current controlled oscillator
CCLK: the PLL output frequency (also the processor clock frequency)
M: PLL Multiplier value from the MSEL bits in the PLLCFG register
P: PLL Divider value from the PSEL bits in the PLLCFG register
The PLL output frequency (when the PLL is both active and connected) is given by:
CCLK = M × FOSC or CCLK = FCCO / (2 × P)
The CCO frequency can be computed as:
FCCO = CCLK × 2 × P or FCCO = FOSC × M × 2 × P
PINSEL0 = PINSEL0 | 0X00000005; /* Enable RxD0 and TxD0 */
The pin connect block allows selected pins of the microcontroller to have more than one
function. Configuration registers control the multiplexers to allow connection between the
pin and the on chip peripherals.
the above line just activates the rx and tx of the controller this is done inorder not to disturb the other pins in PINSEL0.
this also can be written as PINSEL0 |= (1<<0)|(1<<2);
THIS IS BITWISE ASSIGNING OF VALUES AND THAT IS REGISTER LEVEL OF ASSIGNING VALUES
hi arun sharma,
in that we are going to use P0.0 & P0.1 as txd & rxd as serial communication. in this we can't use that port as input.
hi arun sharma,
is your problem solved?
hi
did you test it in hardware?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?