我用CLK=4测试 用示波器测量 发现脉冲的周期是128us 但是理论上来说应该是0.125us 请问是什么情况?
#include "EM78P259N.h"
#define DISI() _asm{disi}
#define ENI() _asm{eni}
#define RET() _asm{RET}
#define MOV() _asm{mov A, @0x00} //0分频
#define CONTW() _asm{contw}
#define CLRA() _asm{clra}
#define SLEP() _asm{slep}
#define LED R61
extern int IntVecIdx; //occupied 0x10:rpage 0
void main(void)
{
_asm
{
nop
nop
nop
nop
nop
nop
}
MOV();
CONTW();
WDTCR=0X00;
P5CR=0xFF;
P6CR=0X00;
LED=0;
TCC=255;
ISR=0;
IMR=0x01;
ENI();
while(1);
}
void _intcall ALLInt(void) @ int
{
switch(IntVecIdx)
{
case 0x4:
break;
case 0x7:
break;
case 0xA:
if(TCIF == 1)
{
TCIF=0;
TCC=255;
LED=!LED;
}
break;
case 0xD:
break;
case 0x10:
break;
case 0x13:
break;
case 0x16:
break;
case 0x19:
break;
case 0x1C:
break;
case 0x1F:
break;
}
}
void _intcall extinterrupt_l(void) @ 0x03:low_int 0
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall port5pinchange_l(void) @ 0x06:low_int 1
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall tcc_l(void) @ 0x09:low_int 2
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall ADconvert_l(void) @ 0x0C:low_int 3
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall comparator_l(void) @ 0x0F:low_int 4
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall highpulse_l(void) @ 0x12:low_int 5
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall lowpulse_l(void) @ 0x15:low_int 6
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall tcca_l(void) @ 0x18:low_int 7
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall tccb_l(void) @ 0x1B:low_int 8
{
_asm{MOV A,0x2
BC 0x3,5
};
}
void _intcall tccc_l(void) @ 0x1E:low_int 9
{
_asm{MOV A,0x2
BC 0x3,5
};
} |