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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 11429|回復: 1
打印 上一主題 下一主題
收起左側

Arduino機械學習筆記06(CNC編程 G code)

[復制鏈接]
跳轉到指定樓層
樓主
*****************************
G code

CNC 的語言
*****************************


在學習 GRBL 過程中,遇到了很多新知識,CNC 編程對我來說也是需要補充學習的。

首先,坐標系統,

G90: Set to Absolute Positioning 設置成絕對定位

Example: G90

All coordinates from now on are absolute relative to the origin of the machine. (This is the RepRap default.)
所有坐標從現在開始變成絕對坐標,即與機器原始位置相對的..
G91: Set to Relative Positioning 設置成相對定位

Example: G91

All coordinates from now on are relative to the last position
所有坐標從現在開始變成相對于當前位置的相對坐標
G92: Set Position 設置位置

Example: G92 X10 E90


可用來設定絕對0點,或者重置現在的位置到規定的坐標。

沒有指定坐標的G92命令會重置所有軸到0 ‘

*********************************

G00



For rapid linear motion, program G0 X… Y… Z… A… B… C…, where all the axis words are
optional, except that at least one must be used. The G0 is optional if the current motion mode is
G0. This will produce coordinated linear motion to the destination point at the current traverse
rate (or slower if the machine will not go that fast). It is expected that cutting will not take place
when a G0 command is executing.

******************************

G01 可控移動





這個G01 仿真有點錯誤(坐標系),不過不影響理解。商用仿真還沒學會。

******************************

G0203









**********************************

內容比較多,先開始再說吧。

*****************************
GROUP1 一覽

在 GRBL 中的代碼實現
*****************************


按照順序,已經理解 G00 G01 G02 G03命令后下一個要理解的命令是 G80,

原因是他們 是同一組的。

group 1= {G0, G1, G2, G3, G38.2, G80, G81, G82, G83, G84, G85, G86, G87, G88, G89} motion

因為GRBL 只是實現了部分命令,

group 1= {G0, G1, G2, G3, G80}


Cancel Modal Motion — G80

Program G80 to ensure no axis motion will occur. It is an error if:
• Axis words are programmed when G80 is active, unless a modal group 0 G code is programmed which uses axis words.

g80是取消固定循環指令。網上搜了一下 華中數控,G80不是這個功能,看來華中數控并沒有遵循RS274規范。

*******************************

在GRBL 中(gcode.c)的實現,

    switch(letter) {
      case 'G':
       // Set modal group values
        switch(int_value) {

          case 0: case 1: case 2: case 3: case 80: group_number = MODAL_GROUP_1; break;
           。。。。

遇到 G0, G1, G2, G3, G80 命令時,把 變量 group_number 賦值 MODAL_GROUP_1。

然后,再具體指令,

        switch(int_value) {
          case 0: gc.motion_mode = MOTION_MODE_SEEK; break;
          case 1: gc.motion_mode = MOTION_MODE_LINEAR; break;
          case 2: gc.motion_mode = MOTION_MODE_CW_ARC; break;
          case 3: gc.motion_mode = MOTION_MODE_CCW_ARC; break;
          。。。。
          case 80: gc.motion_mode = MOTION_MODE_CANCEL; break;
          。。。

設置 相應 的 gc.motion_mode 變量。

剩下是如何具體執行的,可能要把 gcode.c 看完才可以理解。

其中,gc 是一個結構體,
結構
typedef struct {
  uint8_t status_code;             // Parser status for current block

  uint8_t motion_mode;             // {G0, G1, G2, G3, G80}

  uint8_t inverse_feed_rate_mode;  // {G93, G94}

  uint8_t inches_mode;             // 0 = millimeter mode, 1 = inches mode {G20, G21}

  uint8_t absolute_mode;           // 0 = relative motion, 1 = absolute motion {G90, G91}

  uint8_t program_flow;            // {M0, M1, M2, M30}

  int8_t spindle_direction;        // 1 = CW, -1 = CCW, 0 = Stop {M3, M4, M5}

  uint8_t coolant_mode;            // 0 = Disable, 1 = Flood Enable {M8, M9}

  float feed_rate;                 // Millimeters/min

//  float seek_rate;                 // Millimeters/min. Will be used in v0.9 when axis independence is installed
  float position[3];               // Where the interpreter considers the tool to be at this point in the code
  uint8_t tool;
//  uint16_t spindle_speed;          // RPM/100

  uint8_t plane_axis_0,
          plane_axis_1,
          plane_axis_2;            // The axes of the selected plane  
  uint8_t coord_select;            // Active work coordinate system number. Default: 0=G54.
  float coord_system[N_AXIS];      // Current work coordinate system (G54+). Stores offset from absolute machine

                                   // position in mm. Loaded from EEPROM when called.
  float coord_offset[N_AXIS];      // Retains the G92 coordinate offset (work coordinates) relative to
                                   // machine zero in mm. Non-persistent. Cleared upon reset and boot.        
} parser_state_t;


這個結構體包含的指令 就是要理解的,不包含的則不增加學習負擔。
*****************************

另外,GRBL 沒有實現 刀具補償指令,是個大遺憾。好消息是,學習難度小了些。

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

使用道具 舉報

沙發
ID:304387 發表于 2018-4-10 09:29 | 只看該作者
好資料,分享了,謝謝
回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 中文字字幕在线中文乱码范文 | 国产精品久久久久久久久久久久午夜片 | 亚洲欧美成人影院 | 99精品国产一区二区青青牛奶 | 成人高清在线 | 日本男人天堂 | 超碰成人免费 | 午夜欧美一区二区三区在线播放 | 久久久久久久久久久蜜桃 | 黄在线免费观看 | 超碰人人艹 | 99re视频精品 | 人人爽人人爽人人片av | 日韩中文一区二区 | 亚洲人一区 | 日韩视频一区二区 | 国产精品免费福利 | 懂色中文一区二区在线播放 | 国产精品99久久久久久宅男 | 在线观看视频一区 | 亚洲精品一区二区网址 | 西西裸体做爰视频 | 国产一区二区三区四区五区加勒比 | 国产午夜精品一区二区三区四区 | 欧美精品免费观看二区 | 午夜爽爽爽男女免费观看影院 | 五月花丁香婷婷 | 欧美一区二区在线看 | 精品一区二区三区免费视频 | 丝袜久久 | 在线视频一区二区三区 | 精品国产乱码久久久久久图片 | 成人精品鲁一区一区二区 | 午夜影院在线免费观看视频 | 亚洲欧美成人影院 | 国产日韩精品久久 | 日韩精品一区二区三区免费视频 | 日本人和亚洲人zjzjhd | 国产激情偷乱视频一区二区三区 | www国产成人免费观看视频,深夜成人网 | 国产成人99久久亚洲综合精品 |