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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 5932|回復: 3
收起左側

grbl stm32f4移植

[復制鏈接]
ID:344556 發表于 2018-9-7 07:29 | 顯示全部樓層 |閱讀模式
grbl stm32f4 移植工程包:
0.png

單片機源程序如下:
  1. /*
  2.   main.c - An embedded CNC Controller with rs274/ngc (g-code) support
  3.   Part of Grbl

  4.   Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
  5.   Copyright (c) 2009-2011 Simen Svale Skogsrud

  6.   Grbl is free software: you can redistribute it and/or modify
  7.   it under the terms of the GNU General Public License as published by
  8.   the Free Software Foundation, either version 3 of the License, or
  9.   (at your option) any later version.

  10.   Grbl is distributed in the hope that it will be useful,
  11.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.   GNU General Public License for more details.

  14.   You should have received a copy of the GNU General Public License
  15.   along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*
  18.   之前在github上看到了grbl-0.9j在stm32上的移植,于是照貓畫老虎,移植了grbl1.1f-20170131,
  19. 增加了USB虛擬串口,不再需要外接轉換芯片,但其他功能都沒有調試,存在嚴重問題。此次移植了
  20. grbl1.1f-20170801,同時進行了少許調試,目前通訊正常,步進電機接口、冷卻和主軸正常,同時
  21. 加入了四相五線步進接口(x和y),這些在cpu_map.h中有相應定義。但手頭沒有機器,尚未實機測
  22. 試,慎用!
  23.   如有重大問題,請聯系 tuoqiang@outlook.com
  24. */

  25. #include "grbl.h"

  26. // Declare system global variable structure
  27. system_t sys;
  28. int32_t sys_position[N_AXIS];      // Real-time machine (aka home) position vector in steps.
  29. int32_t sys_probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
  30. volatile uint8_t sys_probe_state;   // Probing state value.  Used to coordinate the probing cycle with stepper ISR.
  31. volatile uint8_t sys_rt_exec_state;   // Global realtime executor bitflag variable for state management. See EXEC bitmasks.
  32. volatile uint8_t sys_rt_exec_alarm;   // Global realtime executor bitflag variable for setting various alarms.
  33. volatile uint8_t sys_rt_exec_motion_override; // Global realtime executor bitflag variable for motion-based overrides.
  34. volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bitflag variable for spindle/coolant overrides.
  35. #ifdef DEBUG
  36.   volatile uint8_t sys_rt_exec_debug;
  37. #endif


  38. int main(void)
  39. {
  40.   //USB init
  41.   //Delay Init
  42.   //GPIO CLK init
  43.   Hardware_Init();
  44.   
  45.   // Initialize system upon power-up.
  46.   serial_init();   // Setup serial baud rate and interrupts
  47.   settings_init(); // Load Grbl settings from EEPROM
  48.   stepper_init();  // Configure stepper pins and interrupt timers
  49.   system_init();   // Configure pinout pins and pin-change interrupt

  50.   memset(sys_position,0,sizeof(sys_position)); // Clear machine position.
  51.   asm("cpsie i"); // Enable interrupts

  52.   // Initialize system state.
  53.   #ifdef FORCE_INITIALIZATION_ALARM
  54.     // Force Grbl into an ALARM state upon a power-cycle or hard reset.
  55.     sys.state = STATE_ALARM;
  56.   #endif
  57.   
  58.   // Check for power-up and set system alarm if homing is enabled to force homing cycle
  59.   // by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
  60.   // startup scripts, but allows access to settings and internal commands. Only a homing
  61.   // cycle '$H' or kill alarm locks '$X' will disable the alarm.
  62.   // NOTE: The startup script will run after successful completion of the homing cycle, but
  63.   // not after disabling the alarm locks. Prevents motion startup blocks from crashing into
  64.   // things uncontrollably. Very bad.
  65.   #ifdef HOMING_INIT_LOCK
  66.     if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
  67.   #endif

  68.   // Grbl initialization loop upon power-up or a system abort. For the latter, all processes
  69.   // will return to this loop to be cleanly re-initialized.
  70.   for(;;) {

  71.     // Reset system variables.
  72.     uint8_t prior_state = sys.state;
  73.     memset(&sys, 0, sizeof(system_t)); // Clear system struct variable.
  74.     sys.state = prior_state;
  75.     sys.f_override = DEFAULT_FEED_OVERRIDE;  // Set to 100%
  76.     sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
  77.     sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_OVERRIDE; // Set to 100%
  78.                 memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
  79.     sys_probe_state = 0;
  80.     sys_rt_exec_state = 0;
  81.     sys_rt_exec_alarm = 0;
  82.     sys_rt_exec_motion_override = 0;
  83.     sys_rt_exec_accessory_override = 0;

  84.     // Reset Grbl primary systems.
  85.     serial_reset_read_buffer(); // Clear serial read buffer
  86.     gc_init(); // Set g-code parser to default state
  87.     spindle_init();
  88.     coolant_init();
  89.     limits_init();
  90.     probe_init();
  91.     plan_reset(); // Clear block buffer and planner variables
  92.     st_reset(); // Clear stepper subsystem variables.

  93.     // Sync cleared gcode and planner positions to current system position.
  94.     plan_sync_position();
  95.     gc_sync_position();

  96.     // Print welcome message. Indicates an initialization has occured at power-up or with a reset.
  97.     report_init_message();

  98.     // Start Grbl main loop. Processes program inputs and executes them.
  99.     protocol_main_loop();

  100.   }
  101.   //return 0;   /* Never reached */
  102. }

復制代碼

所有資料51hei提供下載:
grbl1.1f-stm32f103c8-master.zip (471.01 KB, 下載次數: 74)


回復

使用道具 舉報

ID:548018 發表于 2019-6-9 22:30 | 顯示全部樓層
被騙了,明明是F103的。Grbl網站本來就有的。
回復

使用道具 舉報

ID:612008 發表于 2019-9-16 12:05 | 顯示全部樓層
測試過沒有啊
回復

使用道具 舉報

ID:1619 發表于 2021-3-12 08:19 | 顯示全部樓層
貨不對版啊。這是stm32f103的移植,并不是stm32f407
回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 一区二区三区视频在线观看 | 欧美一区二区综合 | 亚洲国产一区在线 | 日韩精品一区二区三区中文在线 | 久久精品91 | 欧美日韩一 | 免费观看毛片 | 成人做爰www免费看视频网站 | 欧美成年黄网站色视频 | 男女网站在线观看 | 天天久久 | 操一草 | 日本天天操 | 九九热视频这里只有精品 | 国产精品永久免费 | 成人免费视频在线观看 | 一区二区不卡视频 | 日韩一区二区久久 | 在线亚洲人成电影网站色www | 中文字幕av第一页 | av日韩精品 | 国产美女在线播放 | 久久久久久免费观看 | 欧美专区在线 | 91精品国产91久久综合桃花 | 在线国产一区二区 | 日韩精品一区二区三区四区视频 | 国产目拍亚洲精品99久久精品 | 色欧美片视频在线观看 | 欧美在线a | 99精品视频在线 | 日韩视频观看 | 国产精品国产三级国产aⅴ浪潮 | 国产精品精品久久久久久 | av一级久久| 国产精品一区在线 | 国产成人综合在线 | 亚洲成a人片 | 久久久精品视频免费看 | 欧美成人一区二区三区 | 国产精品美女在线观看 |