How can I set vector adress in project.prm for MC9S12XHZ512

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

How can I set vector adress in project.prm for MC9S12XHZ512

4,108件の閲覧回数
kdn
Contributor III

How can I set vector adress in project.prm for MC9S12XHZ512, I want to use input capture mode and timer in interrupt.

ラベル(1)
0 件の賞賛
返信
14 返答(返信)

3,739件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

hi KDN,

please refer attached tn101 for how to implement interrupt for 8/16bit MCU.

Vector number can be found in datasheet vector locations table of MC9S12XHZ512 reference manual.

Count from bottom of the table for the “vector number”. the reset vector is vector number 0 (located at address 0), vector number 1 is located just after the vector 0 (at address 0x2) and so on.

ie Reset = 0 (address is $FFFE), Clock monitor reset = 1,  COP watchdog reset = 2 , ...... You can see “Vector Priority” in this table. When the two interrupt occurs, the system will accept the higher priority interrupt.

I also attached a interrupt demo code, it's not for your chip but method is the same for all 16bit MCU.

I think it is simple and readable. Hope it can help you.

Best Regards,

Zhang Jun

=====================================================

this answer is for you. if it helps, please click on "Correct Answer " button. Thanks!

======================================================

0 件の賞賛
返信

3,739件の閲覧回数
kdn
Contributor III

I am using processor expert, is that work on that?

0 件の賞賛
返信

3,739件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

hi KDN,

processor expert implements interrupt in different style.

see project "TimerInt", "Capture" under

C:\Freescale\CWS12V5_1\ProcessorExpert\Projects\Test projects.

processor expert defines interrupt vectors table in file vectors.c.for example, capture interrupt function in vector table is "Cap1_Interrupt". then we can write the related interrupt function inside ISR(Cap1_Interrupt)

Best Regards,

Zhang Jun

=====================================================

this answer is for you. if it helps, please click on "Correct Answer " button. Thanks!

======================================================

0 件の賞賛
返信

3,739件の閲覧回数
kdn
Contributor III

I have written my code in Cap1_OnCapture(void) , call my ISR(Cap1_interrupt) , but it's not working

0 件の賞賛
返信

3,738件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

if you set a breakpoint inside ISR(Cap1_interrupt), can the code run into there?

0 件の賞賛
返信

3,738件の閲覧回数
kdn
Contributor III

How can i set breakpoint

2.png

1.png

0 件の賞賛
返信

3,739件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

you need set breakpoint in debugger but not editor

0 件の賞賛
返信

3,739件の閲覧回数
kdn
Contributor III

I done debugging and check that variable k is not increment, I shown that variable in pic below with circular.

variable problem.png

0 件の賞賛
返信

3,740件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

pls try to set k as local variable and cast it as volatile.

volatile int k=0;

Best Regards,

Zhang Jun

=====================================================

this answer is for you. if it helps, please click on "Correct Answer " button. Thanks!

======================================================

0 件の賞賛
返信

3,740件の閲覧回数
kdn
Contributor III

I try volatile int k=0; , but not working .

0 件の賞賛
返信

3,740件の閲覧回数
kdn
Contributor III

How can i define global variable?

0 件の賞賛
返信

3,740件の閲覧回数
kdn
Contributor III

what is DBG trigger error?

DBG trogger.png

0 件の賞賛
返信

3,740件の閲覧回数
kdn
Contributor III

when I am using this calculation PE providing DBG trigger error

time_interval=(t[1]-t[0]);

time_period=(float)( time_interval);

frequency= 1/time_period;

0 件の賞賛
返信

3,740件の閲覧回数
kdn
Contributor III

how can I use  sprintf(buffer,"%d",time_interval); to print double and long integer

what in place of %d?

0 件の賞賛
返信