sprintf interaction with timer interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

sprintf interaction with timer interrupt

2,117件の閲覧回数
mikey1
Contributor III
for the 9S12X chip I am getting the wrong results from the sprintf function if I am running in Large memory model and have a timer interrupt running.  It apears that the GPAGE register is not preserved correctly and the sprintf code fails to do its thing correctly.  Some times the code even locks up and does not return. the code runs in banked memory model without a hitch.  Do I have something set up wrong for the Large memory model?
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,035件の閲覧回数
mikey1
Contributor III
Thanks for the advice!  I tried it out and it worked great.  Now is my time for complaining.  If an interrupt routine is going to disturb a page register why should we have to tell it to resotre the register when done?  I thought that would be the most logical thing to do!!!!
0 件の賞賛
返信

1,035件の閲覧回数
CrasyCat
Specialist III
Hello
 
You need to tell the compiler it needs to save the GPAGE in the interrupt function entry code and restore it at in the exit code.
 
In order to make sure the GPAGE is preserved over an interrupt you can:
  1- Use pragma TRAP_PROC SAVE_ALL_REGS
      Drawback here is the compiler will save all page registers (PPAGE, GPAGE, RPAGE, EPAGE).
      This might be too much overhead for the interrupt function
  2- Build with option -CpGPAGE=0x10
      An interrupt routine saves, by default, those page registers given by the line options "-Cp".
 
I hope this helps
 
CrasyCat
0 件の賞賛
返信