我使用了微控制器(MC9S12XS128)捕捉脉冲宽度。它曾在调试模式,但同时,结果变得不同,我相信,这是去食堂。因此,它怎么能走呢?
我打开的TIM(TSCR1_TEN = 1)和明确的时间(TCNT = 0)的编号。之后,它才得到的IO(PT0)的TIM的人数(1 = TCNT)是0.Of当然,当PT0下降,该TCNT正在清洗(TCNT = 0)。
这就是所有。
但是,当我们在正常模式下,输出是不对的。
已解决! 转到解答。
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
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?
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