14 Replies Latest reply on Oct 15, 2013 3:41 PM by user_279968365

    Problem on Build a Project: Build Errror: Undefined Reference to "tenthSecond","oneSecond"....

    user_279968365

      Dear All:

         

      Just starting to say that I am new on PSOC Creator and maybe you can tell me what is wrong with the code below. When I try to build the SW that I attache (timing.h, timing.c and main.c)  I get the error above. Anyhelp will be appreciated. Thanks in advance to all.

         

      Regards,Joaquin

         

      -----timing.h code:-----

         

      #include <project.h>
      #include <device.h>

      /******************************************
      *       Global Variables
      ******************************************/

      extern uint8 milliSecond;
      extern uint8 tenthSeconds;
      extern uint8 oneSecond;
      extern uint8 tenSeconds;

      /******************************************
      *   Function Prototypes
      ******************************************/

      /******************************************
      *   Function Name: InitTiming()
      *******************************************
      void InitTiming(void);
      //[] END OF FILE

         

       

         

      ---Code for timing.c:---

         

      #include <device.h>
      #include <timing.h>
      #include "stdio.h"
      #include "stdint.h"

      /******************************************
      *   Global Variables
      ******************************************/
      //Event flags for each of the time periods
      uint8 tenthSeconds= 0U;
      uint8 oneSecond= 0U;
      uint8 tenSeconds= 0u;

      /******************************************
      *       Private Functions
      ******************************************/
      /******************************************
      *Function Name: TimeISR()
      ******************************************
      *******************************************/
      static CY_ISR(TimerIsr)
      {
         
      // Counters for the longer periods
      static uint8  tenthSecondsCount= 0U;
      static uint16 oneSecondCount= 0U;
      static uint16 tenSecondsCount= 0U;
         
      (void)PWM_Timer_STATUS;
      //milliSecond = 1U; // Always set the millisecond global event flag

      //Check if a tenth second has passed
      if (tenthSecondsCount > 99U)
      {    tenthSeconds = 1U;//tenthSecond global event flag
          tenthSecondsCount=0;
      }
      else
          tenthSecondsCount++;

      //Check if a second has passed
      if (oneSecondCount > 999U)
      {
          oneSecond = 1U; //oneSecond global event flag
          oneSecondCount=0;
      }
      else
          oneSecondCount++;

      //Check if a tenseconds has passed
      if (tenSecondsCount > 9999U)
      {
          tenSeconds = 1U; //tenSeconds global event flag
          tenSecondsCount=0;
      }
      else
          tenSecondsCount++;

      } //End of TimeIsr();

      /******************************************
      *       Global Functions
      ******************************************/

      /******************************************
      *Function Name: InitTiming()
      ******************************************/
      void InitTiming(void)
      {
          isr_PWM_Start();
          isr_PWM_SetVector(TimerIsr);
      } // End of InitTiming()


      /* [] END OF FILE */

         

      ---Code for main C---

         

      #include <project.h>
      #include <device.h>
      #include <stdio.h>
      #include "timing.h"
      #include "UART.h"

      #define LCD_NUM_COLUMNS (16u)

      uint8 datos[3]= {0x65, 0x66, 0x67};

      void main()
      {  
          char8 ch;       /* Data received from the Serial port */
          uint8 count = 0u;
          uint8 pos = 0u;

          CyGlobalIntEnable; /* Enable all interrupts by the processor. */
          InitTiming();       // Interrupt
          PWM_Timer_Start();  //Source of interrupt

          LCD_Char_1_Start();
          UART_OXI_Start();
          CyDelay(30); // just to be sure the UART is up and running
          isr_1_Start();      /* Initializing the ISR */
          UART_OXI_ClearRxBuffer();//Clear RXbuffer

          while(1)
          {
              /* Check the UART status */
              ch = UART_OXI_GetChar();

              /* If byte received */
              if(ch > 0)
              {
                  count++;       
                  /* If the count value reaches the count 16 start from first location */
                  if(count % LCD_NUM_COLUMNS == 0u)
                  {
                      pos = 0u; /* resets the count value */
                      /* Display will be cleared when reached count value 16 */
                      LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY);
                  }

                  LCD_Char_1_Position(0u, pos++);
                  LCD_Char_1_PutChar(ch);         /* Print the received character */

                  LCD_Char_1_Position(1u, 0u);
                  LCD_Char_1_PrintInt8(count);    /* Prints the count in the LCD */
                              
                  UART_OXI_SendData(ch);/* Sending the data to Hyperterminal */
               
              }
             
          }
      }


      /* [] END OF FILE */