UART interrupt

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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

View solution in original post

0 Likes
8 Replies
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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

0 Likes
Anonymous
Not applicable

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).

0 Likes
Anonymous
Not applicable

thank you

   

regards

   

kavin

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 hello everyone ,

   

i want to transfer the DATA from the VDAC  to bluetooth module HC-05 

   

can you help me gays to do it 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 what i have done

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 i have changed the instruction of the VDAC by the instruction of UART but i dont receive the exact value 

   

so help me !!!

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

There are projects over here that would accomplish what you want

   

to do (done with PSOC 4) -

   

 

   

www.cypress.com/

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hello sir, I am trying to receive OK command from ESP 8266 but unable to read it, Can

   

you suggest me how to do that??

0 Likes