找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2098|回复: 0
打印 上一主题 下一主题
收起左侧

机械臂小车寻白线stm32程序

[复制链接]
跳转到指定楼层
楼主
ID:245445 发表于 2017-11-2 19:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

单片机源程序如下:
  1. #include "stm32f10x.h"
  2. #include "drive.h"
  3. #include "hongwai.h"
  4. #include "chaoshengbo.h"
  5. #include "timer.h"
  6. #include "delay.h"
  7. #include "stm32f10x_gpio.h"
  8. #include "usart.h"
  9. #include "stm32f10x_it.h"
  10. #include "duoji.h"
  11. #include "shengjiangtai.h"
  12. #include "led.h"
  13. #include "beep.h"
  14. #include "xianwei.h"
  15. int jsnum = 0;
  16. extern int hwflag;
  17. int main()
  18. {
  19.        
  20.           SystemInit();
  21.           driveGPIO_Init();
  22.                 delay_init();                                        //延时初始化
  23.           UltrasonicWave_Configuration();               //对超声波模块初始化
  24.           uart_init(9600);                              //串口初始化
  25.           NVIC_Configuration();                         //设置优先级
  26.           Timerx_Init(5000,7199);                       //10Khz的计数频率,计数到5000为500ms
  27.     TIM3_PWM_Init(899,0);                                //不分频。PWM频率=72000000/900=80Khz
  28.           TIM3_PWM_Init2(899,0);                              //不分频。PWM频率=72000000/900=80Khz
  29.           LED_Init();                                                            //初始化与LED连接的硬件接口
  30.           BEEP_Init();                                         //初始化蜂鸣器端口
  31.     shengjiangtaiGPIO_Init();                     //初始化升降台
  32.     duoji(0x23,0x31,0x32,0x47,0x43,0x31,0x0D,0x0A);
  33.           while(1)
  34.                {
  35.                                         if (jsnum > 500 || hwflag == 1)
  36.                                         {
  37.                                                         UltrasonicWave_StartMeasure();
  38.                                                         jsnum = 0;

  39.                                         }                                                //开始测距,发送一个>10us的脉冲,然后测量返回的高电平时间
  40.                       delay_ms(1);
  41.                                         jsnum++;
  42.                                         LED0=0;
  43.                                         xunji();                               
  44.                      }
  45. }

复制代码

所有资料51hei提供下载:
机械臂小车寻白线程序.rar (296.38 KB, 下载次数: 21)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表