- #include <STC12C5A60S2.H>
- #include <intrins.h>
- #include <stdio.h>
- #include <math.h>
- sbit IN1=P1^0;
- sbit IN2=P1^1;
- sbit ENA=P1^2; //直流电机的端口定义
- unsigned int Counter=0,compare,median;//定时器中断,占空比,接收串口发送的数据
- unsigned int s;
- void UartInit(void) //9600bps@11.0592MHz
- {
- SCON = 0x50;
- TMOD |= 0x20;
- TH1 = 0xFD; //
- TR1 = 1;
- EA = 1;
复制代码
|