The Time of MC9S12XS128 in debugging and normal area

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

The Time of MC9S12XS128 in debugging and normal area

跳至解决方案
2,457 次查看
myonlystar
Contributor I
我使用了微控制器(MC9S12XS128)捕捉脉冲宽度。它曾在调试模式,但同时,结果变得不同,我相信,这是去食堂。因此,它怎么能走呢?
我打开的TIM(TSCR1_TEN = 1)和明确的时间(TCNT = 0)的编号。之后,它才得到的IO(PT0)的TIM的人数(1 = TCNT)为0。
当然,当PT0下降,该TCNT正在清洗(TCNT = 0)。
这就是所有。
但是,当我们在正常模式下,输出是不对的。

 

我使用了微控制器(MC9S12XS128)捕捉脉冲宽度。它曾在调试模式,但同时,结果变得不同,我相信,这是去食堂。因此,它怎么能走呢?


我打开的TIM(TSCR1_TEN = 1)和明确的时间(TCNT = 0)的编号。之后,它才得到的IO(PT0)的TIM的人数(1 = TCNT)是0.Of当然,当PT0下降,该TCNT正在清洗(TCNT = 0)。

这就是所有。


但是,当我们在正常模式下,输出是不对的。

标签 (1)
0 项奖励
回复
1 解答
840 次查看
kef
Specialist I

Please translate your first post, it's not readable.

 

TCNT is not writeable in normal modes.

 

 

           But how to get the TIME number?

 

I don't understand this question. Do you mean how to measure something?

 

unsigned short t0, t1, tdif;

 

    t0 = TCNT;  // get TCNT before something

    something();

    t1 = TCNT; // get TCNT after something

 

   tdif = t1 - t0  // difference is TCNT ticks spent in something

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
840 次查看
myonlystar
Contributor I

ADD:

 

 

          TCNT=0xf0;  

          PORTB=~TCNTL;  

 

The two sentence goes wrong in normal single module, however they are right in debugging.  I think the TCNT could not be read in normal single module. 

 

But how to get the TIME number?

0 项奖励
回复
841 次查看
kef
Specialist I

Please translate your first post, it's not readable.

 

TCNT is not writeable in normal modes.

 

 

           But how to get the TIME number?

 

I don't understand this question. Do you mean how to measure something?

 

unsigned short t0, t1, tdif;

 

    t0 = TCNT;  // get TCNT before something

    something();

    t1 = TCNT; // get TCNT after something

 

   tdif = t1 - t0  // difference is TCNT ticks spent in something

 

0 项奖励
回复
840 次查看
myonlystar
Contributor I

I am a freshman here. 

 

Thank you very much. I have solved the problem.

 

 

 

0 项奖励
回复