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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 11188|回復: 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)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏4 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:331960 發表于 2018-5-17 11:04 | 只看該作者
謝謝分享
回復

使用道具 舉報

板凳
ID:228452 發表于 2018-5-26 05:01 | 只看該作者
Nice work
Thanks
回復

使用道具 舉報

地板
ID:325739 發表于 2018-12-8 10:50 | 只看該作者
多謝樓主分享
回復

使用道具 舉報

5#
ID:445569 發表于 2018-12-19 08:39 | 只看該作者
多謝樓主分享
回復

使用道具 舉報

6#
無效樓層,該帖已經被刪除
7#
ID:298628 發表于 2018-12-24 10:44 | 只看該作者
謝謝分享
回復

使用道具 舉報

8#
ID:395134 發表于 2019-4-17 20:31 | 只看該作者
樓主,你13行到25行的代碼都指的啥呀
回復

使用道具 舉報

9#
無效樓層,該帖已經被刪除
10#
ID:689683 發表于 2020-2-3 17:40 | 只看該作者
感謝分享
回復

使用道具 舉報

11#
ID:68875 發表于 2020-2-6 22:27 | 只看該作者
very good, thank you
回復

使用道具 舉報

12#
無效樓層,該帖已經被刪除
13#
ID:234782 發表于 2022-7-10 10:36 | 只看該作者
謝謝分享,啥時候能發個文檔
回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 91精品国产91久久久久久密臀 | 国产亚洲人成a在线v网站 | 欧美xxxx色视频在线观看免费 | 免费看国产片在线观看 | 婷婷激情在线 | 玖玖玖在线 | 97人人澡人人爽91综合色 | 久久久成人精品 | 日韩精品极品视频在线观看免费 | 天堂网中文字幕在线观看 | 国产高清免费 | 激情综合五月天 | 黄网站在线播放 | 欧美精品综合在线 | 999视频在线播放 | 夜夜操天天操 | 国产视频在线观看一区二区三区 | 中文字幕日韩欧美 | 欧美久久大片 | 久久国产欧美日韩精品 | 精品免费看 | 成人久久网 | 婷婷丁香在线视频 | 天天综合日日夜夜 | 亚洲国产精品一区二区www | 美女视频一区二区 | 久久国产精品一区二区 | 欧美乱大交xxxxx另类电影 | 成人国产精品久久久 | 色综合一区二区 | 日本一区精品 | 一呦二呦三呦国产精品 | 最新国产精品精品视频 | 日韩一区二区三区在线视频 | 伊人免费在线观看高清 | 日日摸日日添日日躁av | 欧美最猛黑人 | 2021狠狠天天天 | 久久精品国产一区二区 | 天天干天天干 | 午夜视频在线播放 |