芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

单片机28BYJ-48步进电机控制器仿真IC解密

IC解密单片机源程序如下:




  1. #include  "macro.h"
  2. typedef unsigned int  u16;
  3. u16 un;
  4. uchar  buf_Direction;                  //?????????
  5. uint  set_speed;                          //?????????
  6. uchar step_motor_loop[8]={0x01,0x03,0x02,0x06,0x04,0x0C,0x08,0x09};//28byj-48电机时序


  7. //uchar step_motor_loop[4]={0x09,0x06,0x03,0x0c};//42步进时序


  8. uchar step_index;


  9. #define CST_STEP_MOTOR_Z      10                                  //??
  10. #define CST_STEP_MOTOR_F       20                                  //??
  11. #define CST_STEP_MOTOR_ST     0                            //?
  12. #define     fosc_12MHz                  12  
  13. #define     fosc_24MHz                  24     
  14. #define     fosc_setting                 fosc_12MHz
  15. //????1
  16. #define CST_TIME_MS    200   
  17. #define CST_TH0          (65536-CST_TIME_MS*fosc_setting/fosc_12MHz)/256
  18. #define CST_TL0          (65536-CST_TIME_MS*fosc_setting/fosc_12MHz)%256
  19. uchar buf_SpeedString[]="    ";


  20. //void iniLCD(void);                                                           
  21. //void list_write_HZ_Str( int x1,int y1,  uchar *point ) ;
  22. void delay(u16 num)
  23. {
  24.         u16 x,y;
  25.         for(x=num; x>0; x--)
  26.                 for(y=110; y>0; y--)
  27.                 {
  28.                         ;//??1ms
  29.                 }
  30. }
  31. void step_motor_driver(void)
  32. {
  33. static uint speed_delay=0;

  34. speed_delay++;
  35. if( buf_Direction==CST_STEP_MOTOR_Z)
  36.    {
  37.    P0=step_motor_loop[step_index];
  38.    if(speed_delay >=set_speed )
  39.      {
  40.       speed_delay =0;
  41.       step_index--;                                                   
  42.       if(step_index <=0)
  43.              step_index =7;
  44. //=================================================转1圈                        
  45.                         un++;
  46.                         if(un>=3600)
  47.                         {
  48.                                 un=0;
  49.                                 step_index=3;
  50.                                 buf_Direction=0;
  51.                                 
  52.                         }
  53.                         //=================================================
  54.           }


  55.    }
  56. else if( buf_Direction==CST_STEP_MOTOR_F)
  57.    {
  58.   
  59.    P0=step_motor_loop[step_index];
  60.    if(speed_delay >=set_speed)
  61.      {
  62.       speed_delay =0;
  63.       step_index++;                                                   //??7,????
  64.       if(step_index >7)
  65.              step_index =0;
  66.                         //=================================================转1圈
  67.                         un++;
  68.                         if(un>=4100)
  69.                         {
  70.                                 un=0;
  71.                                 step_index=3;
  72.                                 buf_Direction=0;
  73.                                 
  74.                         }
  75.                         //============================================
  76.           }
  77.         }
  78. else
  79.     {
  80.       speed_delay =0;
  81.                                 un=0;
  82.                                 step_index=3;
  83.       P0=0x00;
  84.     }

  85. }



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.feixindz.com
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信