找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3137|回复: 0
打印 上一主题 下一主题
收起左侧

grbl 0.9j for stm32f103 master源码

[复制链接]
跳转到指定楼层
楼主
ID:415859 发表于 2018-10-26 17:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在github上找的grbl stm32版本

单片机源程序如下:
  1. #include "project_include.h"
  2. #include "grbl.h"

  3. // Declare system global variable structure
  4. system_t sys;


  5. int main(void)
  6. {               
  7.         JTAG_Set(SWD_ENABLE);                        //JTAG接口状态设置
  8.         delay_init();                                         //延时初始化

  9.         // Initialize system upon power-up.
  10.         serial_init();   // Setup serial baud rate and interrupts
  11.         settings_init(); // Load Grbl settings from EEPROM
  12.         stepper_init();  // Configure stepper pins and interrupt timers
  13.         system_init();   // Configure pinout pins and pin-change interrupt
  14.        
  15.         memset(&sys, 0, sizeof(system_t));  // Clear all system variables
  16.         sys.abort = true;   // Set abort to complete initialization
  17.         sei(); // Enable interrupts
  18.        
  19.         // Check for power-up and set system alarm if homing is enabled to force homing cycle
  20.         // by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
  21.         // startup scripts, but allows access to settings and internal commands. Only a homing
  22.         // cycle '$H' or kill alarm locks '$X' will disable the alarm.
  23.         // NOTE: The startup script will run after successful completion of the homing cycle, but
  24.         // not after disabling the alarm locks. Prevents motion startup blocks from crashing into
  25.         // things uncontrollably. Very bad.
  26. #ifdef HOMING_INIT_LOCK
  27.         if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
  28. #endif
  29.        
  30.         // Force Grbl into an ALARM state upon a power-cycle or hard reset.
  31. #ifdef FORCE_INITIALIZATION_ALARM
  32.         sys.state = STATE_ALARM;
  33. #endif
  34.        
  35.         // Grbl initialization loop upon power-up or a system abort. For the latter, all processes
  36.         // will return to this loop to be cleanly re-initialized.
  37.         for(;;)
  38.         {

  39.             // TODO: Separate configure task that require interrupts to be disabled, especially upon
  40.             // a system abort and ensuring any active interrupts are cleanly reset.
  41.           
  42.             // Reset Grbl primary systems.
  43.             serial_reset_read_buffer(); // Clear serial read buffer
  44.             gc_init(); // Set g-code parser to default state
  45.             spindle_init();
  46.             coolant_init();
  47.             limits_init();
  48.             probe_init();
  49.             plan_reset(); // Clear block buffer and planner variables
  50.             st_reset(); // Clear stepper subsystem variables.
  51.        
  52.             // Sync cleared gcode and planner positions to current system position.
  53.             plan_sync_position();
  54.             gc_sync_position();
  55.        
  56.             // Reset system variables.
  57.             sys.abort = false;
  58.             sys_rt_exec_state = 0;
  59.             sys_rt_exec_alarm = 0;
  60.             sys.suspend = false;
  61.             sys.soft_limit = false;
  62.                       
  63.             // Start Grbl main loop. Processes program inputs and executes them.
  64.             protocol_main_loop();
  65.         }
  66. }
复制代码

所有资料51hei提供下载:
GRBL-0.9j-for-STM32-master.zip (543.22 KB, 下载次数: 77)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表