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.
SMS interrupt 0{ berita(0x0000,0x3fff); } show interrupt 1{ berita(0x4000,0x7fff); } Interrupt 0 and interrupt 1 call the same sub routine but for different purpose. When compiled, the C51 generated warning L15: MULTIPLE CALL TO SEGMENT Segment : ?PR?_BERITA?RTX Caller1 : ?PR?_SMS?RTX Caller2 : ?PR?_SHOW?RTX The program does'nt work at all if the HEX file programmed to the chip AT89S51. Any one please, How to omit the warning, or to use interrupts calls one sub routine for a different purposes. Thank you very much Kurnia Brahmana
I don't know whether it is possible to suppress that specific warning. You would need to be certain that your function is reentrant for this to work, noting that any functions called by that function would also need to be reentrant. Personally I prefer not to call functions from interrupt handlers at all to avoid any potential mistakes. It may be ugly, but I inline all ISR code.
It may be ugly, but I inline all ISR code. That would depend on the eye of the beholder. I think it is beautiful. Erik
Dear Erik Malund Your suggesion solve the problem, but increase the code significantly. But, I will follow your suggestion if no other way to do. Thank you very much.
Dear Stefan Duncanson. Your idea solved the problem but increase the code significantly. The function to be called writes memory in a different area when interrupt is triggered. Thank you very much. Kurnia Brahmana
The function to be called writes memory in a different area when interrupt is triggered. So: what do you hope to win by doing this in a subfunction shared among multiple call trees, given that: 1) you do seem to be worried about overall code size at least a bit, and 2) you've been told twice (and should have been before, when you read the manual), that doing this invariably increases code size, on an 8051, due to the way C's semantics have to be hammered into shape to fit the 8051 design?
Hi Kurnia. Try this, it may solve your problem, As what is already suggested by Stefan, you better use a reentrant stack for the perticular function "berita". While at defination also you put the reentrant attrib, as...
berita(x,y) reentrant; main() { } SMS interrupt 0{ berita(0x0000,0x3fff); } show interrupt 1{ berita(0x4000,0x7fff); } . . . berita(x,y) reentrant { . . }
Try this, it may solve your problem, That is problematic because "reentrant" by definition creates slower code and slower code in ISRs is usually (IMHO always) a bad idea. As what is already suggested by Stefan Stefan "suggested" no such thing, he said "make sure it is reentrant" and stated clearly "Personally I prefer not to call functions from interrupt handlers at all" I advise STRONGLY gainst calling subroutines from ISRs and advise WITH AS MUCH FORCE AS I CAN against calling subroutines from more than one level (if you have to, then only call from main OR only call from one ISR) Erik