cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor

 Hi ,

   

I want to use UART user module.

   

I want to send 4 bytes of data from PC to PSOC. 

   

PSOC when receive should send 2 bytes of data back.

   

I will use a 4 byte array for rx buffer and 2 byte array for tx buffer.

   

When 4 bytes data is received interrupt should occur.

   

How can i implement it 

   

 

   

regards

   

Rocky

0 Likes
Reply
2 Replies
Esteemed Contributor II

Frankly : you cannot.

   

An Interrupt can be generated at the receive of EACH character since interrupts in PSoC 1 are related to hardware.

   

I would suggest to have the number of incoming characters counted (after retrieving and storing them) and when your treshold (or a pre-defined sequence) is reached you set a flag (a global variable) that you inspect in your main-loop and, if set react accordingly (or just inspect the count).

   

 

   

Happy coding

   

Bob

0 Likes
Reply
Anonymous
Not applicable

 I normally use a ring buffer, all data receive would be queue up in the ring buffer and the main loop inspect the head and tail pointer. 

   

if you know the total number of bytes is a fix number, then just do the decoding when the number of bytes received, and if that is correct then send the bytes out.

0 Likes
Reply