|
仿真電路圖:
仿真結(jié)果:
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; //????
- }
- }
復(fù)制代碼
|
|