FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Stepper motor control program (c language microcontroller +51)

     

    "步进电机控制程序(C语言+51单片机) #包括 #定义uint unsigned int#定义uchar unsigned char#定义ms*77//f=12 M#定义LEDLen 4#定义Dj_star(){IE=0x81;pri_dj=0;}#定义Dj_stop(){IE=0x00;pri_dj=1;P1=0xff;沙切=“0”;延时(800ms);延时(800ms);延迟(400ms);shache=1;}#定义Chilun_Num 8/*齿轮数 8.个*/#定义set_display_num(){LEDBuf[0]=tmp/1000;LEDBuf[1]=tmp/100%10;\LEDBuf[2]=tmp/10%10;LEDBuf[3]=tmp%10;}uchar-LEDBuf[LEDLen]={0,0,0};void read_num(); /* 读播码盘 到 设置_round_num*8*/void display();无效延迟(uint delay_TIme){uint i;对于(i=0;延迟时间;i++;}无效运行();void fx_run(); uint round_num=0; /* 记录已转的 齿轮数 , 中断1.次 加 1*/uint set\u round\u num=0; /* 播码盘设置 圈数 */uint设置\u脉宽调制\u宽度=0; /* 播码盘设置 步进电机 正向速度 */位1_round_flg=0;sbit led_1000=P0^7;//用于显示led_100=P0^6;//用于显示led_10=P0^5;//用于显示led_1=P0^4;//用于显示 sbit键启动=P3^0;sbit键=P3^0;sbit键清除=P3^1;/*P3^2接齿轮传感器 中断*/sbit bujin_zx_stop=P3^3; /* 接步进电机 ,正向到位传感器 ,为 0停机 */sbit bujin_fx_stop=P3^4; /* 接步进电机 ,反向到位传感器 ,为 0停机 */ sbit-shache=P3^5; /* 接刹车控制继电器 0 电位有效 */sbit pri_dj=P3^6; /* 接主电机控制继电器 0电位有效 */ void main(){TCON=0x01;显示();而(1){IE=”“0x00”“;round_num=0;显示();如果(bujin_fx_stop)fx_run();while(按键启动);延时(8ms);如果(!键_start){read_num();//设置_round_num=8;而!按键(启动);运行();fx_run(); } }} 无效运行(){#定义延迟时间180/*转一圈 50次循环,每循环 4.步 ,50*4=200200*1.8=360*/uchar i;P1=0xff;设定脉宽调制宽度=15+设定脉宽调制宽度/10;而(1){ 而!沙切!按键(启动);Dj_星();(i=”“0“);布津站&!首席dj;i++{P1=0xf9;延迟(延迟时间);//步进zx_站=P3^3;P1=0xfc;//步进fx\u停止=P3^4;延迟(延迟时间);//key_puse=P3^0;P1=0xf6;//key_clear=P3^1;延迟(延迟时间);//shache=P3^5;P1=0xf3;//pri_dj=P3^6;延迟(延迟时间);如果(i==设置脉宽调制宽度){P1=0xff;i=0;一轮=0;而!一轮如果(!按键{延时(4ms);如果(!按键(puse)中断; } } P1=0xff;如果(pri_dj)中断; 如果(!按键{延时(8ms);如果(!按键{Dj_-stop();而!密钥(puse);//当(!沙什); while(1){while(键puse和键clear);延时(8ms);如果(!键清除){round_num=0;display();}如果(!按键(puse)中断;}而(!密钥(puse);延时(8ms);而!密钥(puse);}}}void ext_int0(void)中断0{/*主电机 齿轮 中断 */uint tmp;EA=0;如果(!pri_dj){round_num++;如果(round_num%Chilun_num==0){one_round_flg=1;tmp=轮数/奇伦数;设置_display_num();P0=0xf0;P0=P0 | LEDBuf[0];led_1000=0;P0 |=0xf0; P0=0xf0;P0=P0 | LEDBuf[1];led_100=0;P0 |=0xf0; P0=0xf0;P0=P0 | LEDBuf[2];发光二极管10=0;P0 |=0xf0; P0=0xf0;P0=P0 | LEDBuf[3];发光二极管1=0;P0 |=0xf0; P0=0xf0;}如果(round_num>=set_round_num)Dj_stop();}EA=0x81;} void display(){uchar i;uint-tmp=0;tmp=轮数/奇伦数;设置_display_num();对于(i=0;我是莱德伦;i++{P0=0xf0;P0=P0 | LEDBuf[i];如果(i==0)led_1000=0;//如果(i==1)led_100=0,则P0^4;//如果(i==2)led_10=0,则P0^5;//如果(i==3)led_1=0,则P0^6;//P0^7 P0 |=0xf0;}P0=0xf0;} void read_num(){/*读播码盘 到 设置圆数,设置圆数

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us