Page 1 of 1

MSP430/I2C Enablization

PostPosted: Thu Aug 02, 2007 4:13 am
by ufsmallsat
I'm trying to interface the MSP430 pin for I2C control and send a byte sequence to configure I2C device. Is this how to drive the for example pin 3.0 to an output and set it to logic 1?

#include <__cross_studio_io.h>
#include <msp430x14x.h>

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01; // Set P1.0 to output direction

for (;
{
volatile unsigned int i;

P3OUT ^= 0x01; // Toggle P3.0 using exclusive-OR

I2C_start(); // Tpyical Bye Sequence
I2C_write(0x20);
I2C_write(0x40);
I2C_write(0x10);
I2C_stop();

i = 50000; // Delay
do (i--);
while (i != 0);
}
}


Re: MSP430/I2C Enablization

PostPosted: Thu Aug 02, 2007 4:18 am
by ufsmallsat
BTW, the build won't recognize I2C_ (what library is this included in?)

Building “I2C_Test” in configuration “Debug”
section placement file referenced segment INFO D not in memory map file
section placement file referenced segment INFO C not in memory map file
Linking I2C_Test.hzx
error: undefined symbol '_I2C_start'
error: undefined symbol '_I2C_write'
error: undefined symbol '_I2C_stop'


Re: MSP430/I2C Enablization

PostPosted: Tue Aug 07, 2007 8:45 am
by aek
Two things:

1) The MSP430F149 does not do I2C ... you have to use the '169, '1611 or '1612.

2) I don't think that the CSK software has any I2C examples right now ... you can see I2C examples in C by looking at some of the TI examples (search ti.com).

------------------