广河一中音乐教师马芳:哪位高人帮偶解释写这段程序啊,特别是前面和当中的部分,越详细越好,谢拉。

来源:百度文库 编辑:神马品牌网 时间:2024/05/07 05:17:29
P6OUT |= REF;
P6DIR |= REF;
P1OUT |= SENSOR;
P1DIR |= SENSOR;
TACCR1 = TAR + 5000; // TACCR1 = TAR + 5ms
TACCTL1 = CCIE; // interrupt
LPM0; // Wait for TACCR1 interrupt
TACCTL1 = 0; // Disable
P1DIR &= ~SENSOR; // Stop driving the sensor
P6OUT &= ~REF; // Discharge through the large resistor
timer_count = TAR; // TAR before discharge
LPM0; // Wait for port1 interrupt
timer_count = snapshot - timer_count; // timer_count =
discharge time
P6DIR &= ~REF; // Disable Sensor or Ref