Presentation is loading. Please wait.

Presentation is loading. Please wait.

MSP430G2553 launchpad and MPU6050 Introduction ----Liqiang Du(EE MS)

Similar presentations


Presentation on theme: "MSP430G2553 launchpad and MPU6050 Introduction ----Liqiang Du(EE MS)"— Presentation transcript:

1 MSP430G2553 launchpad and MPU6050 Introduction ----Liqiang Du(EE MS)

2 MSP430 figure

3 MSP430 pin figure

4 VCC and GND for power supply:3-5v SCL and SDA for I2C communication with MSP430 XCL and XDA to connect magnetic sensor MPU6050 module

5 USCI I2C Mode Figure : I2C Bus Connection Diagram The two pull up resistor is necessary for I2C mode to work properly

6 Figure : I2C Module Data Transfer The first byte after a START condition consists of a 7-bit slave address and the R/W bit. When R/W = 0, the master transmits data to a slave. When R/W = 1, the master receives data from a slave. The ACK bit is sent from the receiver after each byte on the 9th SCL clock. I2C data transfer

7 void Init_i2c(uint8_t devAddr) { UCB0CTL1 |= UCSWRST; // Enable SW reset UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB0BR0 = 10; // fSCL = 1Mhz/10 = ~100kHz UCB0BR1 = 0; P1SEL = BIT6 + BIT7; // Assign I2C pins to USCI_B0 P1SEL2 = BIT6 + BIT7; // Assign I2C pins to USCI_B0 UCB0I2CSA = devAddr; // Slave Address is 069h UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** IE2 |= UCB0RXIE + UCB0TXIE; // Enable RX and TX interrupt } I2C initialization code

8 I2C Master Transmitter Slave Receiver Transmitter I2C Module Operating Modes

9 USCI UART Mode In asynchronous mode, the USCI_Ax modules connect the MSP430 to an external system via two external pins, UCAxRXD and UCAxTXD. UART mode is selected when the UCSYNC bit is cleared. In UART mode, the USCI transmits and receives characters at a bit rate asynchronous to another device. Timing for each character is based on the selected baud rate of the USCI. The transmit and receive functions use the same baud rate frequency.

10 UART initialization code void initUart(void) { UCA0CTL1 |= UCSSEL_2; // Use SMCLK UCA0BR0 = 104; // 1MHz 9600 UCA0BR1 = 0; // 1MHz 9600 UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1 P1SEL = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD P1SEL2 = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** IE2 |= UCA0TXIE; }

11 https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad- Value-Line-Development-kit-P2031.aspx Sensor-Gyroscope-6DOF-Module-3-3V-5V-For-Arduino- / ?pt=LH_DefaultDomain_0&hash=item2582d0 80ce MSP430G2 $9.99 MPU6050 $5.75 Shopping information


Download ppt "MSP430G2553 launchpad and MPU6050 Introduction ----Liqiang Du(EE MS)"

Similar presentations


Ads by Google