C语言编程 单片机输出145khz的方波咋实现??望各位高手指教,不胜感激。
以下有实现输出100Khz的程序,怎么修改参数,能实现输出145khz。算法是什么?急求指点?
/************************** MCU:S52 crystal:24M ****************************/ #include<reg52.h> sbit output=P1^0;//P1.0脚输出100K void timer0_init() { TMOD=0X02;//定时器0方式2 TH0=0XF6;//初始值246 ET0=1;//开中断 EA=1;//开总中断 TR0=1;//开定时器0 } void main() { timer0_init(); while(1); } void timer_isvof()interrupt 1 { output=!output;//中断翻转 }
欢迎光临 (http://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |