Hello,
I am currently building an autonomous jog controller. The pendant uses an ATmega328p which reads a quadrature encoder and some switches, it will deliver $J Gcode instructions.
I am wondering what is the best way to send those instructions to GRBL.
Should I switch TX and RX lines while using the pendant or is there a better option?
评论 (8)
#2 – Jibeji 于 2018-04-25
I want to send them to GRBL, not to the GUI.
#3 – terjeio 于 2018-04-25
Similar to this?
I am “listening in” to grbls real time reports in the second processor. To change to MPG-mode I have connected a switch to the grbl processor (will be momentray in final version). If grbl can switch to MPG mode (is in IDLE state) it adds MPG:1 to the real time report telling the second processor to take over the input stream to grbl. This can be done by a switch, however my implementation uses a secondary UART input. When switching back to normal mode I add MPG:0 to the real time report.
#4 – Jibeji 于 2018-04-25
Yes, very simalar to this, it’s brillant !
Is the switch switching the TX line to GRBL or are you connecting both UART in parallel ?
#5 – terjeio 于 2018-04-25
The second UART stream is input only, the primary always handles the output stream so that is connected in parallell to the PC and the MPG processor.
Since I am using function pointers for grbl access to the HAL (in my ARM port) I switch the input stream to the secondary UART by just swapping the relevant pointers, here is how I do it for TIs MSP432 processor for now:
“ c
static void modeSelect (bool mpg_mode)
{
BITBANDPERI(MODEPORT->IE, MODESWITCHPIN) = 0;
BITBANDPERI(MODEPORT->IES, MODESWITCHPIN) = !mpg_mode;
BITBANDPERI(MODEPORT->IFG, MODESWITCHPIN) = 0;
BITBANDPERI(MODEPORT->IE, MODESWITCHPIN) = 1;
// Deny entering MPG mode if busy
if(mpgmode == sys.mpgmode || (mpgmode && (gcstate.filerun || sys.state != STATEIDLE)))
return;
BITBANDPERI(MODEPORT->OUT, MODELEDPIN) = mpg_mode;
serialSelect(mpg_mode);
if(mpg_mode) {
serial2RxFlush();
hal.serial_read = serial2GetC;
hal.serialgetrxbufferavailable = serial2RxFree;
hal.serialresetread_buffer = serial2RxFlush;
hal.serialcancelread_buffer = serial2RxCancel;
} else {
serialRxFlush();
hal.serial_read = serialGetC;
hal.serialgetrxbufferavailable = serialRxFree;
hal.serialresetread_buffer = serialRxFlush;
hal.serialcancelread_buffer = serialRxCancel;
}
// Report WCO on first status report request from MPG processor
if(mpg_mode)
sys.reportwcocounter = 1;
// Force a realtime status report
hal.protocolprocessrealtime('?');
sys.mpgmode = mpgmode;
}
“
IMO the same can be achieved by using a physical switch on the UART RX signal.
#6 – chamnit 于 2018-04-25
External pendant support is on the to-do list for the next version.
#7 – Jibeji 于 2018-04-26
When will it be released ?
Just to know if I continue my own project in the meantime.
#8 – terjeio 于 2018-04-27
Have a look here and join in if you are interested…
#1 – swarfer 于 2018-04-25
send them to the GUI, then the GUI passes them along to GRBL