biza

problems with UART to send data to PC with MSP432 microcontrolle

1 post in this topic

Hello I have some problems with a UART comunication to pc, I use CCS to program my code and to debug the results I use Terminal. So my code works fine and do everything well, the biggest problem is the features dont appear well in Terminal window. Can anyone help me?I  Send my code and image to apreciate

#include "msp.h"

int main(void){
	UART_TxConfig();
}

void UART_TxConfig(void){
	/*CLOCK SYSTEM SUPORT (CS)*/
	CS->KEY = 0x695A;/*UNLOCK ALL 16 LSB CS REGISTERS*/
	CS->CTL0 = 0;/*RESET PARAMETERS*/
	CS->CTL0 = CS_CTL0_DCORSEL_5;/**/
	/*CLOCK SYSTEM*/
	/*SELA_2		ACLK   = REFOCLK*/
	/*SELS_3		SMCLK  = DCOCLK*/
	/*SELM_3		MCLK   = DCOCLK*/
	CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3;
	/*LOCK ACESSES TO REGISTERS*/
	CS->KEY = 0;/*UNLOCK ALL 16 LSB CS REGISTERS*/

	/*UART PIN CONFIGURATION*/
	P1-> SEL0 |= BIT2 | BIT3; /*SET 2 UART PIN's*/
	/*ACTIVE INTERRUPTION's*/
	__enable_interrupt();
	/*ACTIVE eUSCIA0 INTERRUPT IN NVIC MODULE*/
	NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31);
	/*CONFIGURE UART*/
	UCA0CTLW0 |= UCSWRST;
	UCA0CTLW0 |= UCSSEL__SMCLK;/*SELECT SMCLK CLOCK SOURCE*/
	/*BAUD RATE CALCULATION
	 * 12MHz/(16*9600) =78.125
	 *FRACTIONAL PORTION = 0.125
	 *FRACTIONAL
	 */
	UCA0BR0 = 26;/*48000000/16/115200*/
	UCA0BR1 = 0x00;
	UCA0MCTLW = 0x1000 | UCOS16 | 0x0020;
	/*CONTROL WORD REGISTER*/
	UCA0CTLW0 &= ~UCSWRST;  /*SOFTWARE RESET DISABLE*/
	UCA0IE |=UCRXIE;

	while(1){
	UCA0TXBUF = 'A';
	UCA0TXBUF = 'B';
	UCA0TXBUF = 'C';
	UCA0TXBUF = 'D';
	UCA0TXBUF = 0x61;
	}
}

/*UART INTERRUPT SERVICE ROUTINE*/
void EUSCIA0_IRQHandler (void){
	if (UCA0IFG & UCRXIFG){
		while(!(UCA0IFG&UCTXIFG));
	}


}

 

Screen Shot 2017-03-24 at 18.45.13.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now