proteus与keil Cx51的单片机仿真(定时器输出方波)
T0工作于方式1,定时时间50ms,编写程序使P1.1输出周期为100ms的方波。(波特率f=12MHz)
本文引用地址:https://www.eepw.com.cn/article/201611/320724.htm电路图:
c程序:
#include
#include
Uart_Init();
sbit P1_1=P1^1;
void main()
{
TMOD=0x01;
TL0=0xB0;
TH0=0x3C;
TR0=1;
for(;;)
{
do{}while(!TF0);
TL0=0xb0;TH0=0x3c;
P1_1=!P1_1;
TF0=0;
}
}
评论