- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I want to read 8byte string using UART module and have written the rx interrupt rotine for same as below but not getting the result
#pragma interrupt_handler RX_interrupt
void RX_interrupt (void)
{
char i,j;
for (i=0;i<=7;i++)
{
j= UART_cGetChar();
//UART_PutChar(j);
rx_buff=j;
if (i==7)
{
rx_buff[7]='\0';
rx_flg=1;
}
}
UART_CmdReset();
}
mean while i checked putting below code in main's while loop i am getting the result ,but i want it interrupt based
j= UART_cGetChar();
UART_PutChar(j);
please suggets me ,where i am getting wrong
regards
Habib
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am using PSoc1 ,cy8c22545 controller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Habib, can you please post your complete project, so that we all can have a look at all of your settings? To do so, use
Designer->File->Archive Project
and attach the resulting file.
I can see at first look two errors:
You retrieve a character without checking if there is already one received
You have programmed a loop within your interrupt handler which will prevent the system from running.
Suggestion: Try to program a "Circular Buffer" to store one character after the other.
Bob
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some suggestions:
You enabled the command buffer in the UART component, this will work against your interrupt handling.
You receive an interrupt for every byte received, so change your handler to work on only one byte per interrupt.
No loops, no waiting in an interrupt handler!!!
Better do not declare a loop-variable as global, make use of local variables where appropiate
Declare all global variables that get changed in an interrupt handler as "volatile"
Happy coding
Bob
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob
Thank you very much ,now its working fine ,
if any one facing same problem they can use the above attached project by Bob
Regards
Habib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad that I could help you. What is the intention you would use your PSoC1 for?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
we are having stock and our old designs also on same device ,so