|
楼主 |
发表于 2014-3-26 17:59:17
|
显示全部楼层
*****************************
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 没有实现 刀具补偿指令,是个大遗憾。好消息是,学习难度小了些。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|