CC430

Digital Input/Output on custom CC430 board

Submitted by fabio on Thu, 2012-11-22 15:23.

Just a dumb video testing digital input/output on buttons in my CC430 based project.. nothing fancy but needed testing.

See the SPI LCD connector and the MPU6050 over I2C.. these will be fun!

Here is the code:

#include  <cc430x613x.h>
#include <inttypes.h>

int main(void) {
   unsigned int count;
   uint8_t but0, but1;
   
   WDTCTL = WDTPW + WDTHOLD; //Stop watchdog timer

   P2OUT = 0; //Configure P1 to output on P1.0
   P2DIR |= BIT7;
   
   P5DIR = 0; // configure P5 as input
   P5OUT |= BIT7; // turn on pulldown
   P5OUT |= BIT6;
   P5REN |= BIT6; // enable pullups
   P5REN |= BIT7;

   for(;;){
      but0 = P5IN & BIT7;
      but1 = P5IN & BIT6;
      if((!but0 || !but1)) {
        P2OUT |= BIT7;
      }
      else {
        P2OUT &= ~BIT7;
      }
   }
}
Posted in:

Custom made PCB with CC430 works! Blinking wonderfully :-)

Submitted by fabio on Sat, 2012-10-06 18:14.

I'm working on a little project using the CC430 microcontroller (specifically a CC430F6137) from Texas Instruments.. well, I was a bit skeptical about this project because the micro is pretty hard to solder, (it's a QFN with 64 pins).. however, some time ago I soldered it fine and only today I finally had time to run some code on it.

Well.. it works! I wrote a little blinking program for it, compiled it under Linux and it works! Ahhh.. great! :-)

Here is the code (file name blink.c):

#include  <cc430x613x.h>

int main(void) {
   unsigned int count;
   WDTCTL = WDTPW + WDTHOLD; //Stop watchdog timer

   P2OUT = 0; //Configure P1 to output on P1.0
   P2DIR |= 0x01;

   for(;;){
      P2OUT ^= 0x01; //Toggle P1.0 using exclusive-OR
      for(count=0; count<60000; count++){ /* Insert some delay */ }
   }
}

Under Linux with msp430-gcc you can simply compile it with:

msp430-gcc -mmcu=cc430f6137 blink.c

Then, a file a.out will be generated.. now simply program and run the micro with:

mspdebug rf2500
prog a.out
run

Awesome.

Posted in: