| Electronic Components Datasheet Search |
|
AN1278 Datasheet(PDF) 25 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1278 Datasheet(HTML) 25 Page - STMicroelectronics |
|
25 / 44 page ![]() 25/44 LIN (LOCAL INTERCONNECT NETWORK) SOLUTIONS 4.1 IMPLEMENTATION ON THE ST72254G2 - SOFTWARE EMULATED SCI 4.1.1 Step by Step Configuration lin_config.h Setting Group Comments Text line in lin_config.h CPU operating frequency An external resonator of 16 Mhz is used. As a result the internal CPU frequency is 8MHz. So “FCPU” is set to 8000000. #define FCPU 8000000 Communication peripheral The ST72254 has no SCI periph- eral on chip. As a result the UART communication has to be emulated by one of the 16bit tim- er TimerA or TimerB. TimerA is chosen in this example. As a re- sult “UART_TIMERA” is defined and “UART_TIMERB” and “SCI” are commented out. #define UART_TIMERA //#define UART_TIMERB //#define SCI LIN RX and LIN TX pin definition Depending on the constraints of the board layout and according to the ST72254 pinout we select the Input Capture 1 pin and the Out- put Compare 1 pin for respective- ly the LIN RX and LIN TX signals. The Input Capture 1 pin of Time- rA is linked to the Port B pin 0 (see pin description in the MCU datasheet). As a result LIN_RX_PINNB” is set to 0. Port B data register has the address 0x04. As a result “LIN_PORT_ADD” is defined to 0x04 #define UART_IC1 //#define UART_IC2 #define UART_OC1 //#define UART_OC2 #define LIN_PORT_ADD 0x04 #define LIN_RX_PINNB 0 Timeouts The UART communication is al- ready using one input capture and one output compare of Time- rA. Setting TimerA for the timeout handling will complement the use of the timer. So we define “TIMEOUT_TIMERA“. Output Compare 1 is already used by the UART communication (see UART_OC1) so we define the output compare 2 for the time- outs handling. #define TIMEOUT_TIMERA //#define TIMEOUT_TIMERB //#define TIMEOUT_OC1 #define TIMEOUT_OC2 LIN baudrate The example LIN baudrate is 9600 Baud. #define BAUDRATE 9600 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |