- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.