- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
could you pl help me for getting example code for UART communication using UART interrupt.
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you
regards
kavin
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are projects over here that would accomplish what you want
to do (done with PSOC 4) -
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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??