As IDE I use is CCS v.4 and program in C.
On the schematics of MSP-TS430PM64 (the LCD-less board I have), I notice that the single LED on board – and the one I want to communicate with – is connected to pin 12. Pin 12 is via a jumper J6 -if closed- connected to the LED. If open it is connected to LCD. On my my board it is closed.
On the data sheet of MSP430F42x, the pin number 12 is only marked S0. It is used to connect a LCD and nothing else.
The simplest TI LED demo code, and presumably also valid?? for MSP430F42x MCUs is named fe410_1.c and goes like this:
//*****************************************************************************
// MSP-FET430P410 Demo - Software Toggle P5.1
//
// Description: Toggle P5.1 by xor'ing P5.1 inside of a software loop.
// ACLK = n/a, MCLK = SMCLK = default DCO
//
// MSP430F413
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P5.1|-->LED
//
// M. Buccini
// Texas Instruments Inc.
// Feb 2005
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.21A
//*****************************************************************************
#include <msp430x41x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P5DIR |= 0x02; // Set P5.1 to output direction
for (;;)
{
volatile unsigned int i;
P5OUT ^= 0x02; // Toggle P5.1 using exclusive-OR
i = 50000; // Delay
do (i--);
while (i != 0);
}
}
Here you note that msp430x41x.h is included, but changing it to msp430x42x.h doesn't matter. Further you notice that P5 is chosen as output pin connected to the LED. That is wrong. There is no such pin on msp430x42x, there are only P1 and P2. On MSP430F313 there you find a marking like this: S0 – 12 - P5.1/S0.
Probably found the designer of my board out designer found out that he wanted make use of this duality too.
But that causes problems in the code. At compilation I get following:
"../flashing.c", line 29: error: identifier "P5DIR" is undefined
"../flashing.c", line 35: error: identifier "P5OUT" is undefined
2 errors detected in the compilation of "../flashing.c".
If I change P5 to P2 it compiles! I get the following:
<Linking>
'Finished building target: flashing.out'
' '
Build complete for project flashing
It is also possible to load the program and run it:
MSP430: Program loaded. Code Size - Text: 74 bytes Data: 2 bytes, but of course the is no flashing LED.
I think I have to make some changes in msp430x41x.h, but I do not know how to open it and where exactly make the changes.
Can somebody post me a hint in the right direction.