Fixup overflow

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,406件の閲覧回数
sandeepnaik
Contributor I

I am using MC9S08LG32 controller and developing software using CW 10.2 Special Edition: Code Warrior for Micro-controllers 10.2 (Eclipse, Windows hosted). I am using small memory model (where by default far locations are used)

I am getting Fix-up Overflow in one of my interrupt service routine.

In that routine is a variable say count.

When I explicitly specify this variable as near I get the fix-up overflow error. As soon I remove this near specifier the error is solved. Can some-one tell me what exactly is happening.

ラベル(1)
0 件の賞賛
1 解決策
1,001件の閲覧回数
bigmac
Specialist III

Hello,

 

If your requirement is that the count variable retain its value between function calls, the static modifier should be used.  The variable will then be placed in RAM, rather than the stack.  Unlike global variables, the variable will only be visible from within the function in which it is defined.

 

Regards,

Mac

 

元の投稿で解決策を見る

0 件の賞賛
3 返答(返信)
1,002件の閲覧回数
bigmac
Specialist III

Hello,

 

If your requirement is that the count variable retain its value between function calls, the static modifier should be used.  The variable will then be placed in RAM, rather than the stack.  Unlike global variables, the variable will only be visible from within the function in which it is defined.

 

Regards,

Mac

 

0 件の賞賛
1,001件の閲覧回数
CrasyCat
Specialist III

Hello

 

  When you define a variable inside of a function, the variable is allocated on the stack.

 

  The near qualifier only applies to variables allocated between 0x00 and 0xFF.

   As your stack is not allocated there, you should not define your local variable a near.

 

CrasyCat

0 件の賞賛
1,001件の閲覧回数
sandeepnaik
Contributor I

When you define a variable inside of a function, the variable is allocated on the stack.

 

  The near qualifier only applies to variables allocated between 0x00 and 0xFF.

   As your stack is not allocated there, you should not define your local variable a near.

 

CrasyCat

 

Sir,

The variable count I declared is a global variable and is not allocated space in the routine.

 

0 件の賞賛