Dear Sir:
I bought a couple of MPS430 development boards and I am currently evaluating TI's IDE.
The two boards I bought utilize different hardware targets (MSP430F5529 and MSP430G2553).
My question is a general question that concerns:
1) The portability of C code across different hardware targets.
2) The validity of C programming methods over time. I will explain what I mean with regard to this question by uploading a simple program from a hardware platform that I have never used before but whose code is of interest.
I know that since the hardware is different, the supporting files (headers files, etc., etc.) will be different. That said, my question concerns the feasibility of developing working code by looking at the "form" of old code and how I can identify whether the "old" programming method can operate in the same way in my newer development boards.
Let's answer this question by using an example. I am uploading a program named, "butled1.c". This program does not appear to use interrupts. I have looked at the pushbutton sample programs for the MSP430G2553 target in resource explorer and this code uses interrupts to interface with the pushbutton.
My question is, if you look at the program "butled1.c", can you tell me if there is a "working," analogous, programming "form", using the MSP430G2553, that will work in the same way that "butled1.c" did, without using interrupts?
If the answer to this question is, yes, then can this working analogous code be applied to the CC5 IDE such that when I press the push button, I can watch the ports and registers change values dynamically, without using any interrupts in my code?
Let me stop here. As this discussion evolves, I forsee that it is probable that all my questions can be answered as I receive an answer to each topic.
Thank you for your courtesy and I look forward to reading your reply.
// butled1.c - press button to light LED // Single loop with "if" // Olimex 1121STK board, LED1 active low on P2.3, // button B1 active low on P2.1 // J H Davies, 2006-06-01; IAR Kickstart version 3.41A //---------------------------------------------------------------------- #include <msp430x11x1.h> // Specific device // Pins for LED and button on port 2 #define LED1 BIT3 #define B1 BIT1 void main (void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P2OUT |= LED1; // Preload LED1 off (active low!) P2DIR = LED1; // Set pin with LED1 to output for (;;) { // Loop forever if ((P2IN & B1) == 0) { // Is button down? (active low) P2OUT &= ~LED1; // Yes: Turn LED1 on (active low!) } else { P2OUT |= LED1; // No: Turn LED1 off (active low!) } } }