欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: stm32-gbrl-g代碼解釋程序 [打印本頁]

作者: asd150080    時間: 2018-3-19 16:03
標題: stm32-gbrl-g代碼解釋程序
stm32-gbrl-g代碼解釋程序

單片機源程序如下:
  1. /***************************************************************/
  2. //2013.8.27  Copyright@ rhyme呆瓜云
  3. /***************************************************************/
  4. #include "stm32f10x.h"
  5. #include "stdio.h"
  6. #include "gpio.h"
  7. #include "usart.h"
  8. #include "delay.h"
  9. #include "tim.h"
  10. #include "eeprom.h"
  11. #include "pwm.h"

  12. #include "config.h"
  13. #include "planner.h"
  14. #include "nuts_bolts.h"
  15. #include "stepper.h"
  16. #include "spindle_control.h"
  17. #include "coolant_control.h"
  18. #include "motion_control.h"
  19. #include "gcode.h"
  20. #include "protocol.h"
  21. #include "limits.h"
  22. #include "report.h"
  23. #include "settings.h"
  24. #include "serial.h"

  25. /***************************************************************/
  26. u8 USART_RX[60]={""};
  27. u8 USART_mark=0;
  28. u8 Press_mark=0;
  29. int USART_control=0;
  30. int USART_data=0;
  31. u16 USART_RX_STA;       //接收狀態(tài)標記       

  32. uint16_t ee;//EEPROM變量
  33. u8 mo=1;
  34. /***************************************************************/


  35. int main(void)
  36. {
  37.         RCC_Configuration();
  38.         delay_Configuration(72);
  39.         USART1_Configuration(9600);
  40.         PB9_OUT
  41.         Set_B9
  42.        
  43. //        PB8_OUT
  44. //        Set_B8
  45. //        delay_ms(200);
  46. //        Clr_B8
  47. //        delay_ms(200);
  48. //        Set_B8
  49. //        delay_ms(300);
  50. //        Clr_B8
  51.        
  52. //        PA7_OUT
  53. //        Clr_A7
  54. //       
  55. //        PA6_OUT
  56. //        Clr_A6
  57.        
  58.        
  59.        
  60.         Motors_Set_GPIO();//電機IO口定義
  61.        
  62. //        FLASH_Unlock();
  63. //        EE_Init();
  64.         settings_reset(true);//GRBL重置所有參數(shù)
  65.         //讀取EEPROM 設(shè)定FEED和SEEK
  66. //        if(!EE_ReadVariable(32,&ee))
  67. //        {
  68. //                settings.default_feed_rate = ee;
  69. //                settings.default_seek_rate = ee;
  70. //        }
  71.         TIM_Configuration(TIM2,1001,1,1);
  72.         st_init(); //步進電機初始化,用這兩個中斷,通過 “布雷森漢姆直線算法”同時控制三個步進輸出。
  73.        
  74.         memset(&sys, 0, sizeof(sys));  //清數(shù)組
  75.        
  76.         sys.abort = true;   // 設(shè)置abort 標志著初始化完成
  77.   sys.state = STATE_INIT;  // 設(shè)置一個警示標志來指示未知的初始位置
  78.        
  79. //        TIM3_PWM_Configuration(20,3600,1,1,0,0);
  80. //        PA6_OUT
  81. //        Set_A6
  82. //        PA7_OUT
  83. //        Clr_A7
  84.         while(1)
  85.         {
  86.                
  87.                   if (sys.abort) {
  88.       // Reset system.
  89.       serial_reset_read_buffer(); // Clear serial read buffer
  90.       plan_init(); // Clear block buffer and planner variables
  91.       gc_init(); // Set g-code parser to default state
  92.       protocol_init(); // Clear incoming line data and execute startup lines
  93.       spindle_init();
  94.       coolant_init();
  95.       limits_init();
  96.       st_reset(); // Clear stepper subsystem variables.

  97.       // Sync cleared gcode and planner positions to current system position, which is only
  98.       // cleared upon startup, not a reset/abort.
  99.       sys_sync_current_position();

  100.       // Reset system variables.
  101.       sys.abort = false;
  102.       sys.execute = 0;
  103.       if (bit_istrue(settings.flags,BITFLAG_AUTO_START)) { sys.auto_start = true; }
  104.       
  105.       // Check for power-up and set system alarm if homing is enabled to force homing cycle
  106.       // by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
  107.       // startup scripts, but allows access to settings and internal commands. Only a homing
  108.       // cycle '$H' or kill alarm locks '$X' will disable the alarm.
  109.       // NOTE: The startup script will run after successful completion of the homing cycle, but
  110.       // not after disabling the alarm locks. Prevents motion startup blocks from crashing into
  111.       // things uncontrollably. Very bad.
  112.       #ifdef HOMING_INIT_LOCK
  113.         if (sys.state == STATE_INIT && bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
  114.       #endif
  115.       
  116.       // Check for and report alarm state after a reset, error, or an initial power up.
  117.       if (sys.state == STATE_ALARM) {
  118.         report_feedback_message(MESSAGE_ALARM_LOCK);
  119.       } else {
  120.         // All systems go. Set system to ready and execute startup script.
  121.         sys.state = STATE_IDLE;
  122.         protocol_execute_startup();
  123.       }
  124.     }       
  125.                        

  126.                
  127.     protocol_execute_runtime();
  128.     protocol_process(); // ... process the serial protocol
  129.     if(mo==0) {MotorsEnable(0x00);mo=10;}
  130.                
  131. //                delay_ms(500);
  132. //                Set_B12
  133. //                delay_ms(500);
  134. //                Clr_B12
  135. //                printf(" This is the STM32 Demo !!! \r\n");
  136.         }
  137.        
  138. }
  139. /***************************************************************/

復(fù)制代碼

所有資料51hei提供下載:
STM32-GRBL-master.rar (412.7 KB, 下載次數(shù): 176)



作者: mamingle666    時間: 2018-5-17 11:04
謝謝分享
作者: mick32    時間: 2018-5-26 05:01
Nice work
Thanks
作者: yibunihao    時間: 2018-12-8 10:50
多謝樓主分享
作者: swapkernel1    時間: 2018-12-19 08:39
多謝樓主分享
作者: 肥佬的黑貓    時間: 2018-12-24 10:44
謝謝分享
作者: Poker_    時間: 2019-4-17 20:31
樓主,你13行到25行的代碼都指的啥呀
作者: WGY116    時間: 2020-2-3 17:40
感謝分享
作者: cnc2020    時間: 2020-2-6 22:27
very good, thank you
作者: yulin3192    時間: 2022-7-10 10:36
謝謝分享,啥時候能發(fā)個文檔




歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1