We've built a CNC like machine using GRBL 0.9c (https://github.com/grbl/grbl/wiki) which is programmed into our Arduino UNO microcontroller board.
We have the 'Cycle Start/Resume' Uno pin connected to a pushbutton (green for us), and have set the 'Auto-Start' variable $14 to off ($14=0) (https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.8#14---auto-start-bool). This allows us to load an entire file of gcode command and have the machine not move until we press our green button, which is very nice.
Our problem is that it only works for programs with only G01, G02, G03 commands but not M4, M5 commands that we use to turn our spindle on/off. When the GRBL interpreter hits our M4 or M5 commands it waits for another green button press (low signal on 'Cycle Start/Resume' Uno pin).
Here is some gcode which runs fine, i.e. one green button press is enough to execute the entire program:
g90
f100000
g01 x0 y0 z0
g01 x150 y130 z0
g01 x-150 y130 z0
g01 x-150 y-130 z0
g01 x150 y-130 z0
g01 x150 y130 z0
g01 x0 y0 z0
And here some gcode which stops after every M4 or M5 command:
g90
f100000
g01 x0 y0 z0
g01 x150 y130 z0 m4
g01 x-150 y130 z0 m5
g01 x-150 y-130 z0 m4
g01 x150 y-130 z0 m5
g01 x150 y130 z0
g01 x0 y0 z0
It does not matter if the M4 and M5's are on separate lines.
Anyone know how to make the GRBL interpreter not wait for the spindle on/off (M4/M5) commands?
It turns out that will be changed in the next version of Grbl. I have v0.9c.
This was answered on Github by a/the Grbl programmer. https://github.com/grbl/grbl/issues/611
I think Github/grbl and shapeoko are better forums for this topic.
Related
I have one table from this type:
Equipment TimestampEqmt
truck1 timetruck1
truck2 timetruck2
truck3 timetruck3
truck1 timetruck4
truck2 timetruck5
truck3 timetruck6
and another with GPS coordinates for the trucks
Equipment TimestamGPS X Y Z
truck1 TimestamGPS1 X1 Y1 Z1
truck2 TimestamGPS2 X2 Y2 Z2
truck3 TimestamGPS3 X3 Y3 Z3
truck1 TimestamGPS4 X4 Y4 Z4
truck2 TimestamGPS5 X5 Y5 Z5
truck3 TimestamGPS6 X6 Y6 Z6
truck1 TimestamGPS1 X7 Y7 Z7
truck2 TimestamGPS2 X8 Y8 Z8
truck3 TimestamGPS3 X9 Y9 Z9
truck1 TimestamGPS1 X10 Y10 Z10
truck2 TimestamGPS2 X11 Y11 Z11
truck3 TimestamGPS3 X12 Y12 Z12
How to get for every TimestampEqmt and Equipment from first table, first GPS coordinates where TimestamGPS < TimestampEqmt?
The result should be like this:
Equipment TimestampEqmt TimestamGPS X Y Z
truck1 timetruck1 TimestamGPS7 X7 Y7 Z7
truck2 timetruck2 TimestamGPS11 X11 Y11 Z11
truck3 timetruck3 TimestamGPS12 X12 Y12 Z12
Which means that TimestamGPS7 is the first smaller timestamp depending on timetruck1 for truck1.
I am trying to let the program draw a hexagon, The program should let the user enter the coordinates of two points only, I will assume those points are the terminals of a side, then I need to calculate the coordinates of other four points, but how?
P.S: I use the library graphics.h that contains draw polygon which requires 2 arrays of x and y coordinates for all points
Given two points (x1, y1), (x2, y2), the next point on the hexagon can be computed with the formulas
dx = x2 - x1
dy = y2 - y1
x3 = x2 + ((√3)/2) dx - (1/2) dy
y3 = y2 + (1/2) dx + ((√3)/2) dy
These are derived from general rotation formulas; note that cos 60° = (√3)/2 and sin 60° = 1/2.
I have a row array as shown below:
X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 X4 Y4 Z4 ..... Xn Yn Zn
This row array always starts with the value of X and with the value of Z. I want to rearrange them as a multidimensional array:
X1 X2 X3 X4 X5 .... Xn
Y1 Y2 Y3 Y4 Y5 .... Yn
Z1 Z2 Z3 Z4 Z5 .... Zn
The size of the original array varies in each case. Any help to how to approach this problem would be helpful.
Use reshape function setting second dimension as []
reshaped_array = reshape(myarray,3,[]);
This is the prototype for the function:
v4si __builtin_ia32_shufps (v4si, v4si, int)
On some websites I found they had but hex in the int field, and it looked liked it separated high and low bits, but what I want is a logical 32 bit shift.
X3 X2 X1 X0 shifted by 32 bits to get X2 X1 X0 0
Another example using 2 v4si vectors:
X7 X6 X5 X4 | X3 X2 X1 X0, where each X is a 32 bit and what I want for a shift is the
same a logical shift, but with each vector element. So:
X7 X6 X5 X4 | X3 X2 X1 X0 << 2 = X5 X4 X3 X2 | X1 X0 0 0
Is shufps the right command to do this?
Looking at your example with two vectors I think what you're probably looking for is _mm_alignr_epi8 (PALIGNR). This works for any shift of a pair of vectors by an arbitrary number of bytes, so you would need to multiply the shift parameter by sizeof(int), e.g.
v = _mm_alignr_epi8(v0, v1, 2 * sizeof(int));
Note that this instruction is only available in SSSE3 and later, which means pretty much any Intel CPU since ~ 2005.
I'm interested in finding the fastest way (lowest cycle count) of comparing the values stored into NEON registers (say Q0 and Q3) on a Cortex-A9 core (VFP instructions allowed).
So far I have the following:
(1) Using the VFP floating point comparison:
vcmp.f64 d0, d6
vmrs APSR_nzcv, fpscr
vcmpeq.f64 d1, d7
vmrseq APSR_nzcv, fpscr
If the 64bit "floats" are equivalent to NaN, this version will not work.
(2) Using the NEON narrowing and the VFP comparison (this time only once and in a NaN-safe manner):
vceq.i32 q15, q0, q3
vmovn.i32 d31, q15
vshl.s16 d31, d31, #8
vcmp.f64 d31, d29
vmrs APSR_nzcv, fpscr
The D29 register is previously preloaded with the right 16bit pattern:
vmov.i16 d29, #65280 ; 0xff00
My question is: is there any better than this? Am I overseeing some obvious way to do it?
I believe you can reduce it by one instruction. By using the shift left and insert (VLSI), you can combine the 4 32-bit values of Q15 into 4 16-bit values in D31. You can then compare with 0 and get the floating point flags.
vceq.i32 q15, q0, q3
vlsi.32 d31, d30, #16
vcmp.f64 d31, #0
vmrs APSR_nzcv, fpscr