Hi there,
I am very new to programming with the MSP430, besides running the test code and fiddling with minor changes I have little experience with it. I am programming with the TI Code Composer Studio v5
I am currently trying to use the Honeywell HMC5883L with the MSP430. I am confused about how to start communication with it and what libraries I need to use. The datasheet for the HMC5883L has some pseudocode, but I need to know what libraries to use.
My code so far:
#include <msp430.h>
#include <msp430g2553.h>
int Tx[4]; //Array for transmitting data to HMC5883L registers; initialisation bits, configuration, etc.
int Rx[6]; //Array for reading data from HMC5883L registers; X-Y-Z magnetic readings
/*Initialising Transmitting Array*/
Tx[0] = 0x3C; //HMC5883 specific call to write data to it.
Tx[1] = 0x70; //Config Register A: Data rate and Measurement mode.
Tx[2] = 0xE0; //Config Register B: Gain setting.
Tx[3] = 0x01; //Single-measurement mode -> switches to idle mode after storing measured data.
g_LED = 0x40;
r_LED = 0x01;
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer.
P1DIR |= g_LED; //Set green LED to output initially, indicate ambient/earth mag field.
}
For starters I want to be able to read some data from the HMC registers which automatically stores some data on the magnetic readings upon start-up.