- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have declared as external tenthSecond & oneSecond, but no where do I see
their initialization declaration ? Thats what the compiler is complaining about.
Are these defined in in another file that is not "#include"-ed ?
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tenthSeconds, oneSecond and tenSeconds are initialized at the top of timing.c. This should be fine.
Maybe you can upload your project? (File / Create workspace bundle) That way we can compile for ourself...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes but compiler complaining about oneSecond as well. Its references all typed
properly.
Maybe compiler overreach on scan, reporting an error triggered by another ?
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the code I can not see a reference to 'tenthSecond', there is only one in a comment. So it should compile, except when there is something we don't know about...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So something doesn't fit together - the source code doesn't match the error message. That's why we need the source...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change the externals in timing.h to -
extern uint8 milliSecond;
extern uint8 tenthSecond;
extern uint8 oneSecond;
extern uint8 tenSecond;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When building the UART_HOST project, I see the same problem as dana (conflicting declarations of the variables), but this is not the one you described.
The real error happens on the UART_TFT project. It is because you reference the variables there in main.c, but don't declare them anywhere (timing.cfrom the first project is not part of this project...).
Remember, each of your four projects is separate. So you need to define your variables in each of them, and they will be different ones...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
Effectively I have deleted the UART_TFT_TOUCHSCREEN project from the workspace and it works. I had this project in the workspace for reference but it was disturbing more than helping.
Thank you all for your support.
Joaquin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I want a program which is combination of some programs, I created a program by two ways of combining first is to create header & source file & then add them in one main file & second is by calling function. I created but i'm getting some errors in both of the program.
errors in first program are -undefined reference to `UART_DEB_PutCRLF'
undefined reference to `UART_DEB_PutString'
Errors in second program are- expected identifier or '(' before 'typedef'
unknown type name '__int8_t'
The errors in second program are in generated source.
I'm attaching both of my programs here, Please give me suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cannot load the first archive, files are missing or paths are wrong.
Your errors in second file are quite too much, I would suggest you to start anew combining 2 projects and then adding the 3rd...
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, Got it.
Thank You.