Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 225252

Forum Post: RE: MSP430F6638: Port_Mapping on MSP430F6638

$
0
0
Her is my init Port_Mapping and Init_UART code: void Port_Mapping_RS232(void) { // Disable Interrupts before altering Port Mapping registers __disable_interrupt(); // Enable Write-access to modify port mapping registers PMAPPWD = 0x02D52; #ifdef PORT_MAP_RECFG // Allow reconfiguration during runtime PMAPCTL = PMAPRECFG; #endif P2MAP2 = PM_UCA0RXD; P2MAP3 = PM_UCA0TXD; // Disable Write-Access to modify port mapping registers PMAPPWD = 0; #ifdef PORT_MAP_EINT __enable_interrupt(); // Re-enable all interrupts #endif } //----------------------------------------------- void Init_UART(void) { // 0001 1000 P2SEL |= 0x0C; // Assign port mapping P2.2 to UCA0RXD and P2.3 to UCA0TXD 0000 1100 P2DIR |= 0x0C; // P2.3 to UCA0TXD UCA0CTL1 |= UCSWRST; // **Put state machine in reset** // This 115200 code is working on TI EVM; // Max. Error Tx -0.6 to 0.8; // Max. Error Rx -1.8 to 1.1; UCA0CTL1 = UCSSEL_2; // DCO = SMCLK = 8MHz UCA0BR0 = 69; // 8MHz/115200 = 69,44. 69 = 0x45 UCA0BR1 = 0; // Baudrate bliver: 8M / ( (4 * 69 + 4 * 70)/8) = 115107,9 (Der deles med 69,5) UCA0MCTL = UCBRS_4 + UCBRF_0; // Modulation UCBRSx=4, UCBRFx=0 UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt }

Viewing all articles
Browse latest Browse all 225252

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>