We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using Keil in C Programming Language.
How do I use an serial port interrupt to receive raw data and store it into the buffer and then, process it?
Just the same you would do if you would use any other C programming language.
It isn't "Keil in C Programming Language" that is the important issue. It's what hardware you use that matters. Something you - oops - forgot to mention.
But since you mention C51 as architecture - check all the sample code that is available. They will show you how to set up the baudrate, initialize the serial port. Write an interrupt service routine (ISR) to handle UART events.
Read up on circular buffers. Also known as round robin buffers. They are excellent for use in a producer/consumer environment where the ISR adds incomming characters and the main program processes them. Or where the main program emits data to send, and the ISR feeds the UART.
Also known as Ring Buffers.
Keil provide an example of interrupt-driven, ring-buffered serial comms using C51...
It is a very widely used approach; should be covered by any decent embedding programming book - or, indeed, any decent programming book
http://www.keil.com/books
Yes, all good programming books covers this concept, since you don't have to work with embedded programming to have producer/consumer situations, with a need to buffer the pipe between them.
The concept is so easy with a read pointer, a write pointer and a bit of buffer space. And no need to move the buffer contents just because you insert or remove one entry. So the efficiency is constant for a large or small buffer. No expensive memory moves needed.