标题: 寄存器怎么就不清零了呢!!!!! [打印本页] 作者: dreamprosper 时间: 2008-7-5 02:48 标题: 寄存器怎么就不清零了呢!!!!! 我们的测速程序,大家帮忙看一下:<br> TIOS=0x00; // PT0-2 is set to be IC (input capture) mode<br> TCTL4=0b00000000; // ÎÊÌâ³öÔÚÕâÀïÁË£¿ // Õâ¸öÐèÒª¸ÄһϠ//<br> ICOVW_NOVW3=1; // protected<br> ICPAR_PA3EN=1; // enable pulse accumulator 3<br> TSCR2=0x07; // Õâ¸öÇáÒײ»Òª¸ÄÁË£¬ÊÔÁËÎÞÊý±éÁË 128·ÖƵ<br> // disable INTERUPT when TCNT overflow<br> TSCR1=0x80; // enable timer TCNT, activate bit TEN<br> TIOS=0x00; // PT0-PT2 are set to be IC (input captured) mode<br> TCTL4_EDG1A=1; // capture on rising edges or falling edges<br> TCTL4_EDG1B=0; //shangshengyan bu zhuo<br> ICOVW_NOVW1=0;<br> ICSYS_BUFEN=1; // open hold register<br> ICSYS_TFMOD=1; // after transfer the data to hold register, set the flagC3F<br><br> ICSYS_LATQ=0; // apply queue mode <br> //a1 = TC1; // read data from IC register<br> //a2 = TC1H; // read data from holding register<br> SP = TC1 - TC1H; // obtain the current speed<br><br><br><br>这个是读的通道寄存和保持寄存的差值,在单位时间内的脉冲个数差值<br><br>问题是TC1 和TCIH 不是清零,读回来的SP 就不准啊,拜托大家帮忙看看,怎么能让TC1和TCIH清零呢!!!!<br><br><br>谢谢<br>作者: auto 时间: 2008-7-5 19:37 标题: Re:寄存器怎么就不清零了呢!!!!! TC1是不用清的,是记录作者: dreamprosper 时间: 2008-7-5 19:41 标题: Re:寄存器怎么就不清零了呢!!!!! 那怎么测速轮都不转了,还显示上次的脉冲数呢?