pic16f877单片机C语言程序指令周期

请问一下程序如何完成延时2s,3s的
#include "pic.h"
void delay(unsigned int x)
{
unsigned char i;
while(x--)
{ for(i=0;i<125;i++);
}
}
void main ()
{
trisd=0x00;
port=0x00;
while(1)
{portd=0x55;
delay(2000);
portd=0xAA;
delay(3000)
我就是不明白for语句是占用多少的时间?怎么算的?求各位大侠帮帮忙!

第1个回答  2009-05-04
就是能过函数delay(i)来延时的