Pumpkin, Inc.

Pumpkin User Forums

MSP430/I2C Enablization

If you can't make Salvo do what you want it to do, post it here.

MSP430/I2C Enablization

Postby ufsmallsat » Thu Aug 02, 2007 4:13 am

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);
}
}

ufsmallsat
 
Posts: 7
Joined: Fri Nov 04, 2005 12:00 am
Location: Gainesville, FL USA

Re: MSP430/I2C Enablization

Postby ufsmallsat » Thu Aug 02, 2007 4:18 am

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'

ufsmallsat
 
Posts: 7
Joined: Fri Nov 04, 2005 12:00 am
Location: Gainesville, FL USA

Re: MSP430/I2C Enablization

Postby aek » Tue Aug 07, 2007 8:45 am

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).

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron