仿真电路图:
仿真结果:
C语言程序代码:
- #include<reg51.h>
- sbit OSC = P2^0;
- main()
- {
- TMOD=0x01;
- TH0=0x3C;
- TL0=0xB0;
- EA=1; //?????
- TR0=1; //??T0???
- ET0=1; //??????0??
- while(1);
- }
- void ET0_ISR(void) interrupt 1 //????
- {
- unsigned int i;
- TH0=0x3C;
- TL0=0xB0;
- i++;
- if(i == 1)
- {
- OSC = 0; //36us???????,????
- }
- else if (i == 3)
- {
- OSC = 1; //360us???????,????
- i=0; //????
- }
- }
复制代码
|