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.
hi everyone i am new to 8051 and and have some problem with interrupts while working with kiel software.
i am unable to pass arguments to following function
void serial_isr(char code *ptr) interrupt 4
please do reply
good day....
i am new to 8051 and and have some problem with interrupts while working with kiel software.<p>
Your problem has nothing to do with Keil software, but with the 8051 architecture. Or, in a more general sense, with the concept of interrupt functions.
You cannot pass an argument to an interrupt function.
It is that simple. An interrupt function does not have a "caller" that could pass arguments to the function, since it is called by hard-wired logic inside the processor. (Note that if you perform an explicit call of an interrupt function anywhere in your program, you have introduced a quite nasty bug).
Any data your interrupt function required must be delivered in some other way (i.e. kept in global variables and similar).
See also:
http://www.keil.com/support/man/docs/c51/c51_le_interruptfuncs.htm
"The following rules apply to interrupt functions." ... "No function arguments may be specified for an interrupt function." ... "Interrupt function declarations may not include a return value."
Your problem has nothing to do with Keil software, but with the 8051 architecture.
That, while true, is wrong.
it does not have to do with "the 8051 architecture" it has to do with interrupts on any processor
Erik
OK, so now we've established that you cannot pass parameters to interrupt handlers - not in Keil, not using anything else on an 8051, and not even on any other processor.
So, why don't you explain what you're actually trying to achieve - then maybe people can suggest ways to reach that goal...
t does not have to do with "the 8051 architecture" it has to do with interrupts on any processor
... you need to add "hardware interrupts". If you're using an operating system to route the interrupts for you, you may pass arguments to the handlers (which will be plain-vanilla functions in that case).
hi
thanx for ur reply. now i got where was the problem.
bye