RE: Re: error #20: identifier "TA0CCTL0_bit" is undefined....help on code composer

"'Redd, Emmett R' [email protected] [msp430]" <[email protected]> Tue, 9 Dec 2014 10:41:44 -0600
Newsgroups gmane.comp.hardware.texas-instruments.msp430.discuss
Message-ID <[email protected]>
I don't use Code Composer nor have I used the G2553, but I see some variation in your code below which might help answer your questions.

I don't see _bit used anywhere else, but I do see:

ADC10CTL0 |= ADC10SHT_3 + ADC10ON + MSC;

(which BTW is poor practice; | should replace +)

Perhaps you should have:

TA0CCTL0 |= CCIE ; 

Emmett Redd Ph.D.   mailto:[email protected]
Professor                                 (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University             Fax (417)836-6226
901 SOUTH NATIONAL                   Lab (417)836-3770
SPRINGFIELD, MO  65897   USA    Dept (417)836-5131

In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: [email protected] [[email protected]]
Sent: Tuesday, December 09, 2014 9:37 AM
To: [email protected]
Subject: [msp430] Re: error #20: identifier "TA0CCTL0_bit" is undefined....help on code composer

I am using the msp430g2553....

I have enclosed the complete program below.....I believe the original software used iar to compile using "io430.h" header which I cannot use in code composer. I am new at this and am struggling with final project for a class. I have two marked lines with errors with ****** after //....

Thanks Ted

#include <msp430g2553.h>
#include <msp430.h>
#include <intrinsics.h>
#include <stdint.h>
//#include <io430.h>                  //.......??????why?

#define NUMBER_OF_DIGITS 2
#define TACCTL0_               TA0CCTL0_      /* Timer A Capture/Compare Control 0 */
#define TACCTL1_               TA0CCTL1_      /* Timer A Capture/Compare Control 1 */
#define DELAY 1000
#define TIMER_DELAY 630
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
char seg[16];
char d[5];
char digit;
short v;

// simple software delay
void delay(unsigned long d)
{
  unsigned long i;
  for (i = 0; i < d; i++);
}

void display_hex(unsigned short v)
{ // enter with 16-bit integer v
  // fill global array d[ ]
  short i;
  for (i = 0; i < 4; i++)
  {
     d[i] = v % 16;
     v = v/16;
  }
}

void display_BCD(unsigned short v)
{// enter with 16-bit integer v
 // fill global array d[ ]
  short i;
  for (i = 0; i < 5; i++)
  {
     d[i] = v % 10;
     v = v/10;
  }
}

#pragma vector = TIMER0_A0_VECTOR
__interrupt void myTimerISR(void)
{
  digit = ++digit % NUMBER_OF_DIGITS;   //use MOD operator
  P1OUT = ~seg[d[digit]];
  P2OUT = 1 << digit;
}

void init(void)
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;

  // initialize Timer0_A
  TA0CCR0 = TIMER_DELAY;                  // set up terminal count
  TA0CTL = TASSEL_2 + ID_3 + MC_1;  // configure and start timer

  // enable interrupts
  TA0CCTL0_bit.CCIE = 1;   // enable timer interrupts********
  __enable_interrupt();    // set GIE in SR**********

  P1DIR  = 0xFF;       // enable segment outputs
  P2DIR  = 0x0F;   // enable digit select

  // create 7-segment table
  seg[0]  = 0x3F;
  seg[1]  = 0x06;
  seg[2]  = 0x5B;
  seg[3]  = 0x4F;
  seg[4]  = 0x66;
  seg[5]  = 0x6D;
  seg[6]  = 0x7D;
  seg[7]  = 0x07;
  seg[8]  = 0x7F;
  seg[9]  = 0x67;
  seg[10] = 0x77;
  seg[11] = 0x7C;
  seg[12] = 0x39;
  seg[13] = 0x5E;
  seg[14] = 0x79;
  seg[15] = 0x71;

  digit = 0;
}

void initADC(void)
{
  // initialize 10-bit ADC
  ADC10CTL1 = INCH_7 + CONSEQ_2; // use P1.7 (channel 7)
  ADC10CTL0 |= ADC10SHT_3 + ADC10ON + MSC;
  ADC10AE0 |= BIT7; // enable analog input on channel 7
  ADC10CTL0 |= ADC10SC + ENC; // start conversions
}

void main( void )
{
 init();
 initADC();

 while (1)
 {
   v = ADC10MEM;
   display_BCD(v);
   delay(DELAY);
 }

}




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

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

To unsubscribe from the msp430 group, send an email to:
[email protected]