![Freescale Semiconductor MPC5604B Скачать руководство пользователя страница 93](http://html1.mh-extra.com/html/freescale-semiconductor/mpc5604b/mpc5604b_quick-start-manual_2330604093.webp)
Figure 103 : UART Message Buffer (R.M. Rev8 –Table 21-30)
The DTF flag is raised when the specified amount of bytes have been transmitted, and similarly
for DRF. If RXEN(or TXEN) is cleared during a transmission, the current transmission is still
completed then no further action is done till RXEN(or TXEN) is set.
4.
Developing a general purpose UART Driver
In a similar way to the DSPI, a driver was developed to limit LINFlex’s use to a high level UART
interface usage, for simple transfer of 8-bit data (array) at common baud rates.
Transfer functions are similar to the SPI Driver’s, there is single data transfer functions, read,
write and exchange. And there are data array transfer functions like write_array, read_array,
listen_till. But there is also a high level formatted writing function called rprintf for sending
simple messages that might contain information about internal data.
Example:
struct
_UART_DRV UART[];
//UART variable has to be imported from the UART
//Driver module
uint8_t
RxData[128];
//An array for storing received data
int
main(
void
) {
initModesAndClks();
//remember to enable LinFlex module
//and set Sys_Clk(=Peripheral_Clock) to 64MHz if you
//wish to use predefined baud-rates
initPeriClkGen();
disableWatchdog();
initialise_UART_DRIVER();
//must be called before using the driver
enableIrq();
UART[
0
].init(
UART_BAUD_9600
,
UART_FRAME_8N1
);
//Initialize UART module
//Connect pins of PORT B to a serial interface of a PC
UART[0].rprintf(
"Welcome to MPC5604B!\n\r"
,);
//simple way for sending
//messages to a PC serial terminal
UART[0].rprintf(
"What do you want to do?\n\r1.PWM\n\r2.ADC"
,););
UART[0].read(RxData);
//The PC user can send commands, or use UART for
debugging.
switch
(RxData[0]){
case
1: UART[0].rprintf(
"PWM is running!\n\r"
,);
//do PWM stuff etc
...
//do relevant stuff etc.
}
while
(
1
) {}
//End of program
Содержание MPC5604B
Страница 1: ...LAAS CNRS Quick Start to MPC5604B Embedded Development Sahin Serdar 21 06 2013...
Страница 31: ...Figure 33 INTC SW HW mode comparison Freescale Tutorial...
Страница 87: ......
Страница 132: ......
Страница 133: ...127 Appendix 2 Pad Configurations...
Страница 134: ......
Страница 135: ......
Страница 136: ......
Страница 137: ......
Страница 138: ......
Страница 139: ......
Страница 140: ......
Страница 141: ...Appendix 3 Peripheral input pin selection...
Страница 142: ......
Страница 143: ...137 Appendix 4 Interrupt Vector Table...
Страница 144: ......
Страница 145: ......
Страница 146: ......
Страница 147: ......
Страница 148: ...Appendix 5 I C Baud Rate Prescaler Values...
Страница 149: ......
Страница 150: ......