Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > UART interrupt

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



UART interrupt
Moderator:
RKRM

Post Reply
Follow this topic



UART interrupt

gkavin posted on 07 Aug 2012 10:30 PM PST
Top Contributor
22 Forum Posts

could you pl help me for getting example code for UART communication using UART interrupt.

 




Re: UART interrupt

srim posted on 07 Aug 2012 12:04 AM PST
Cypress Employee
121 Forum Posts

 gkavin,

 

I've written a simple code below that triggers a interrupt whenever a byte is sent via uart. you can implement a similar code in your design.

 

#include <device.h>

uint8 tx_intr =0;

 

CY_ISR( UART_INTERRUPT_ROUTINE ) 

   tx_intr = 1;

}

void main()

{

uint8 sample_data = 0x55; //byte to send

CYGlobalIntEnable; 

UART_1_Start();

isr_1_StartEx(UART_INTERRUPT_ROUTINE);

UART_1_EnableTxInt();

 

while(1)

{

UART_1_WriteTxData(sample_data++);

if(tx_intr)//Interrupt when data transmitted.

{

tx_intr = 0;//clear interrupt

}

CyDelay(200);

}

}

 

Thanks,

srim



Re: UART interrupt

Gautam Das posted on 14 Aug 2012 11:50 PM PST
Cypress Employee
742 Forum Posts

Hi gkavin,

 

If you want to use interrupt on receive, you can use the same technique as that demonstrated by SRIM in the previous comment. Handling of the recieved byte can be done in the ISR or in the main code (when ISR is just used to set a flag).



Re: UART interrupt

gkavin posted on 21 Aug 2012 03:42 AM PST
Top Contributor
22 Forum Posts

thank you

regards

kavin






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20