|
要求p2.1輸出頻率,多謝指教
頻率 | 480HZ | 周期 | T=0.00208S | 上升沿 | T1=0.001386S | 下降沿 | T2=0.00069S | 占空比 | 66.67% |
下面程序行得通嗎?
sbit PULSEP14 = P2^1;
void PulesOutP14()
{
static unsigned int cntout = 0;
if(cntout < 139)
PULSEP14 = 1;
else
PULSEP14 = 0;
cntout++;
if(cntout >= 208)
cntout = 0;
}
/*
0 --> 1 --> 2 --> 3 --> 4
----------------\________________
*/
|
|