"直流电机控制Keil c51源代码详解" 在这个 Keil c51 源代码中,我们可以看到它是一个直流电机控制系统的实现。下面我们将对这个代码进行详细的分析和解释。 这个代码包括了多个函数的声明和定义,例如 `timer_init()`、`setting_PWM()`、`IntTimer0()` 和 `main()`。这些函数的作用分别是:初始化定时器、设置 PWM 的脉冲宽度和方向、处理定时器中断和主函数。 在 `timer_init()` 函数中,我们可以看到它是用来初始化定时器的。它将定时器 1 设置为工作模式 2,即 8 位自动重装模式,并将定时器的预置值设置为 `timer_data`,即 256-100=156,这表示定时器的时钟频率为 12M 时钟下的 0.1ms。然后,它将定时器启动,并允许中断。 在 `setting_PWM()` 函数中,它用于设置 PWM 的脉冲宽度和方向。当 `PWM_count` 等于 0 时,它将 PWM 的脉冲宽度设置为 20,并将方向设置为 1。 在 `IntTimer0()` 函数中,它是定时器中断处理程序。当定时器计数达到 `PWM_T` 时,它将 `time_count` 重置为 0,并将 `PWM_count` 递增 1。然后,它将根据 `time_count` 的值来设置 PWM 的输出值。 在 `main()` 函数中,它是用户主函数。它首先调用 `timer_init()` 函数来初始化定时器,然后调用 `setting_PWM()` 函数来设置 PWM 的脉冲宽度和方向。 在这个代码中,我们还可以看到一些变量的定义,例如 `PWM_t`、`PWM_count`、`time_count` 和 `direction`。这些变量分别用于存储 PWM 的脉冲宽度、PWM 的周期计数、定时器的计数和方向标志位。 此外,这个代码还包括了一些预定义的值,例如 `PWM_T`,它定义了 PWM 的周期为 10ms。 这个 Keil c51 源代码是一个完整的直流电机控制系统的实现,它包括了定时器的初始化、PWM 的设置、定时器中断处理和主函数等多个部分。通过对这个代码的分析和解释,我们可以更好地理解直流电机控制系统的实现原理和方法。
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![uvproj](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/release/download_crawler_static/12724220/bg1.jpg)
![](https://csdnimg.cn/release/download_crawler_static/12724220/bg2.jpg)
剩余6页未读,继续阅读
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
- 粉丝: 3
- 资源: 942
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)