MSP430 - Multiplexed 7-Segment Displays Errors

Discussion in 'The Projects Forum' started by ivaninspace, Jul 28, 2013.

  1. ivaninspace

    Thread Starter New Member

    Jul 28, 2013
    10
    0
    Hello people, I'm very new to micro controllers so bare with.
    As the title states I am trying to run the Multiplexed 7-seg example from this webpage but I keep having these errors pop up and cant get past the build stage and I am wanting to make my way to the digital thermometer.

    This is the project:
    http://forum.allaboutcircuits.com/blog.php?b=559

    The errors I get are:
    #20 identifier "TA0CCTL0_bit" is undefined
    #20 identifier "P1OUT_bit" is undefined
    #135 expedted a field name

    I changed the head to:
    #include "MSP430G2553.h"

    Can any one offer and help?
    Thank you for your time!!!
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    How can we help you debug your code if you don't post your code?

    You may be basing your code on the code on the webpage, but it obviously isn't exactly the same since that code doesn't have P1OUT_bit anywhere in it.

    The best guess I can make based on what you've given is that the header file you are using has a somewhat different naming scheme for things.

    Please post your code and your error messages (and tell us what compiler you are using). Also, look carefully to see if the error messages indicated a line number in any way and include that info, too. It would also help if your print the line numbers in your source code, if possible.
     
    ivaninspace likes this.
  3. ivaninspace

    Thread Starter New Member

    Jul 28, 2013
    10
    0
    Code ( (Unknown Language)):
    1.  
    2. #include <stdio.h>
    3. #include <msp430.h>
    4. //--------------------------------------------------------
    5. // Project #2 - Multiplexed Seven-segment LED interface
    6. // 2013.06.11 - MrChips
    7. //--------------------------------------------------------
    8.  
    9. #define NUMBER_OF_DIGITS 3
    10. #define DELAY 100000
    11. #define TIMER_DELAY 630
    12.  
    13. char seg[16];
    14. char d[5];
    15. char digit;
    16.  
    17. // simple software delay
    18. void delay(unsigned long d)
    19. {
    20.   unsigned long i;
    21.   for (i = 0; i < d; i++);
    22. }
    23.  
    24. void display_hex(unsigned short v)
    25. { // enter with 16-bit integer v
    26.   // fill global array d[ ]
    27.   short i;
    28.   for (i = 0; i < 4; i++)
    29.   {
    30.      d[i] = v % 16;
    31.      v = v/16;
    32.   }
    33. }
    34.  
    35. void display_BCD(unsigned short v)
    36. {// enter with 16-bit integer v
    37.  // fill global array d[ ]
    38.   short i;
    39.   for (i = 0; i < 5; i++)
    40.   {
    41.      d[i] = v % 10;
    42.      v = v/10;
    43.   }
    44. }
    45.  
    46. #pragma vector = TIMER0_A0_VECTOR
    47. __interrupt void myTimerISR(void)
    48. {
    49.   digit = ++digit % NUMBER_OF_DIGITS;   //use MOD operator
    50.   P1OUT = ~seg[d[digit]];
    51.   P2OUT = 1 << digit;
    52. }
    53.  
    54. void init(void)
    55. {
    56.   // Stop watchdog timer to prevent time out reset
    57.   WDTCTL = WDTPW + WDTHOLD;
    58.  
    59.   // initialize Timer0_A
    60.   TA0CCR0 = TIMER_DELAY;                  // set up terminal count
    61.   TA0CTL = TASSEL_2 + ID_3 + MC_1;  // configure and start timer
    62.  
    63.   // enable interrupts
    64.   TA0CCTL0_bit.CCIE = 1;   // enable timer interrupts
    65.   __enable_interrupt();    // set GIE in SR
    66.  
    67.   P1DIR  = 0xFF;       // enable segment outputs
    68.   P2DIR  = 0x0F;   // enable digit select
    69.  
    70.   // create 7-segment table
    71.   seg[0]  = 0x3F;
    72.   seg[1]  = 0x06;
    73.   seg[2]  = 0x5B;
    74.   seg[3]  = 0x4F;
    75.   seg[4]  = 0x66;
    76.   seg[5]  = 0x6D;
    77.   seg[6]  = 0x7D;
    78.   seg[7]  = 0x07;
    79.   seg[8]  = 0x7F;
    80.   seg[9]  = 0x67;
    81.   seg[10] = 0x77;
    82.   seg[11] = 0x7C;
    83.   seg[12] = 0x39;
    84.   seg[13] = 0x5E;
    85.   seg[14] = 0x79;
    86.   seg[15] = 0x71;
    87.  
    88.   digit = 0;
    89. }
    90.  
    91. void main( void )
    92. {
    93.  unsigned int n;
    94.  init();
    95.  
    96.  n = 0;
    97.  
    98.  while (1)
    99.  {
    100.    n++;
    101.    display_BCD(n);
    102.    delay(DELAY);
    103.  }
    104.  
    105. }
    106. [/i][/i]
     
    Last edited by a moderator: Jul 31, 2013
  4. ivaninspace

    Thread Starter New Member

    Jul 28, 2013
    10
    0
    I'm using the newest version of code composer, 5.4

    The line below gets the error:
    TA0CCTL0_bit.CCIE = 1; // enable timer interrupts

    the error message:
    #20 identifier "TA0CCTL0_bit" is undefined
    #135 expedted a field name

    I open the welcome screen and start a new c/c++ project with my MSP440G2553 information all selected correctly. I open up a hello world or LED blink project and replace the code with the above code posted.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    With Code Composer, use

    TA0CCTL0 |= 0x0010; // set CCIE bit
     
    ivaninspace likes this.
  6. TedL

    New Member

    Dec 8, 2014
    2
    0
    Hi,

    My name is Ted L. I am a student @ MATC in Milwaukee, WI.

    I believe part of the problem is with code composer, as a lot of these programs used IAR as a compiler, not code composer. One suggestion that helped me with the code was to use TA0CCTL0 |= CCIE ; this resolved my errors on the temp display project. However I am still having issues with the transistors temperature signal input. I hope this helps.

    Ted
     
  7. TedL

    New Member

    Dec 8, 2014
    2
    0
    Hi,

    My name is Ted L. I am a student @ MATC in Milwaukee, WI.

    I believe part of the problem is with code composer, as a lot of these programs used IAR as a compiler, not code composer. One suggestion that helped me with the code was to use TA0CCTL0 |= CCIE ; this resolved my errors on the temp display project. However I am still having issues with the transistors temperature signal input. I hope this helps.

    Ted
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    Hello Ted and welcome to AAC,

    Just to let you know, you are replying to a thread that was active for all of three days about a year and a half ago. Chances are the the OP is no longer following it.
     
Loading...