久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 11056|回復: 10
收起左側

stm32-gbrl-g代碼解釋程序

  [復制鏈接]
ID:294084 發表于 2018-3-19 16:03 | 顯示全部樓層 |閱讀模式
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;       //接收狀態標記       

  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重置所有參數
  65.         //讀取EEPROM 設定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));  //清數組
  75.        
  76.         sys.abort = true;   // 設置abort 標志著初始化完成
  77.   sys.state = STATE_INIT;  // 設置一個警示標志來指示未知的初始位置
  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. /***************************************************************/

復制代碼

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

使用道具 舉報

ID:331960 發表于 2018-5-17 11:04 | 顯示全部樓層
謝謝分享
回復

使用道具 舉報

ID:228452 發表于 2018-5-26 05:01 | 顯示全部樓層
Nice work
Thanks
回復

使用道具 舉報

ID:325739 發表于 2018-12-8 10:50 | 顯示全部樓層
多謝樓主分享
回復

使用道具 舉報

ID:445569 發表于 2018-12-19 08:39 | 顯示全部樓層
多謝樓主分享
回復

使用道具 舉報

ID:298628 發表于 2018-12-24 10:44 | 顯示全部樓層
謝謝分享
回復

使用道具 舉報

ID:395134 發表于 2019-4-17 20:31 | 顯示全部樓層
樓主,你13行到25行的代碼都指的啥呀
回復

使用道具 舉報

ID:689683 發表于 2020-2-3 17:40 | 顯示全部樓層
感謝分享
回復

使用道具 舉報

ID:68875 發表于 2020-2-6 22:27 | 顯示全部樓層
very good, thank you
回復

使用道具 舉報

ID:234782 發表于 2022-7-10 10:36 | 顯示全部樓層
謝謝分享,啥時候能發個文檔
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日日想夜夜操 | 久久婷婷香蕉热狠狠综合 | 日韩在线播放第一页 | 91视频亚洲 | 91精品成人久久 | 在线国产视频 | 久久国产一区二区 | 成人网av| 99精品视频一区二区三区 | 欧美成人精品一区 | 在线观看国产h | 综合九九 | 噜噜噜噜狠狠狠7777视频 | 99精品一级欧美片免费播放 | 日韩高清中文字幕 | 日本精品视频一区二区三区四区 | 久久国产欧美日韩精品 | 亚洲一二三区在线观看 | 久草在线 | 一区精品国产欧美在线 | 久久成人av电影 | 亚洲一区二区三区免费在线观看 | 在线播放一区二区三区 | 凹凸日日摸日日碰夜夜 | 欧美不卡一区二区三区 | 欧美在线视频一区二区 | 久久国产成人精品国产成人亚洲 | 国产精品久久久久久一区二区三区 | 人人鲁人人莫人人爱精品 | 插插插干干干 | 最新日韩av| 久久久久一区 | 一级特黄视频 | 天天干夜夜操 | 亚洲影音先锋 | 日日干干夜夜 | 成人一区二区三区在线 | 亚洲最大看片网站 | 亚洲一区二区三区四区五区中文 | 九九热精品视频在线观看 | 日韩精品福利 |