Arduino based USB Pendant for Linuxcnc
- Tchefter
-
- Offline
- Elite Member
-
- Posts: 195
- Thank you received: 31
it shows /dev/ttyACM0
So i changed this in serialcon to this
#define DEVICE "/dev/ttyACM0"
Should this be ok?
while nothing happens after:
fh@v3:~/linuxcnc/configs/CNCV3$ sudo halcompile --install serialcon2.comp
[sudo] password for fh:
gcc -Os -g -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon2 /tmp/tmp40WBeb/serialcon2.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
Greetings Fritz
EDIT: i test the Port with the simple Blink-Example, that works...
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 758
So i changed this in serialcon to this
#define DEVICE "/dev/ttyACM0"
Should this be ok?
If that is the device port you are using, then it is correct.
/dev/ttyUSB0 is more normal, but depends on the board.
while nothing happens after:
fh@v3:~/linuxcnc/configs/CNCV3$ sudo halcompile --install serialcon2.comp
[sudo] password for fh:
gcc -Os -g -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon2 /tmp/tmp40WBeb/serialcon2.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
Don't understand what you are trying to say.
The print just shows you have compiled the component and installed it to /usr/bin probably.
However please be aware you have compiled a component called serialcon2, but your hal file is loading a component called
serialcon
loadusr -W serialcon
The name of the file and the component must be the same as each other
github.com/LinuxCNC/linuxcnc/blob/master...ls/halcompile.g#L958
because otherwise halcompile would fail.
So you probably are trying to load a component which does not exist, albeit you haven't actually said what the problem is.
Please Log in or Create an account to join the conversation.
- Tchefter
-
- Offline
- Elite Member
-
- Posts: 195
- Thank you received: 31
loadusr -W serialcon
The name of the file and the component must be the same as each other
github.com/LinuxCNC/linuxcnc/blob/master...ls/halcompile.g#L958
because otherwise halcompile would fail.
So you probably are trying to load a component which does not exist, albeit you haven't actually said what the problem is.
Holy Moly!!! I AM SO STUPID




Thank You ArcEye that was Problem, i forgot to change from serialcon to serialcon2
You made my Day

Please Log in or Create an account to join the conversation.
- Tchefter
-
- Offline
- Elite Member
-
- Posts: 195
- Thank you received: 31
I have installed a red / green LED: red Estop is free, green machine is on

Thanks again!

Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
Rick G
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 758

Please Log in or Create an account to join the conversation.
- Tchefter
-
- Offline
- Elite Member
-
- Posts: 195
- Thank you received: 31

i want use some MDI Commands on the Keypad.
My Thoughts where, change the output for the LCD in the INO File like this:
case '*': // MDI 1
if(!bEstop && bMachine)
{
Serial.write('1');
lcd.setCursor(13, 2);
lcd.print("XY-0 ");
}
break;
case '0': // MDI 2
if(!bEstop && bMachine)
{
Serial.write('2');
lcd.setCursor(13, 2);
lcd.print("Z-0 ");
}
break;
case '#': // MDI 3
if(!bEstop && bMachine)
{
Serial.write('3');
lcd.setCursor(13, 2);
lcd.print("CAM OFF");
}
break;
and in the serialcon2 like this:
case '1':
system("halcmd setp halui.mdi-command-01 1");
system("halcmd setp halui.mdi-command-02 0");
system("halcmd setp halui.mdi-command-05 0");
break;
case '2':
system("halcmd setp halui.mdi-command-01 0");
system("halcmd setp halui.mdi-command-02 1");
system("halcmd setp halui.mdi-command-05 0");
break;
case '3':
system("halcmd setp halui.mdi-command-01 0");
system("halcmd setp halui.mdi-command-02 0");
system("halcmd setp halui.mdi-command-05 1");
break;
Must i add the Commands in my postguil.hal like this ?
net remote-xy-home halui.mdi-command-01 <= serialcon2.xy-home
net remote-z-home halui.mdi-command-02 <= serialcon2.z-home
net remote-fraeser0- halui.mdi-command-05 <= serialcon2.fraeser0-
Or w/o the <=
This is my current custom_postgui.hal
# Benutzerdefinierte HAL-Anweisungen können nachfolgend angegeben werden
# Die Befehle in dieser Datei werden nach der AXIS GUI (und PyVCP-Panel) ausgeführt.
loadusr -W serialcon2
net Xpos halui.axis.0.pos-relative serialcon2.xposition
net Ypos halui.axis.1.pos-relative serialcon2.yposition
net Zpos halui.axis.2.pos-relative serialcon2.zposition
loadrt mult2
addf mult2.0 servo-thread
setp mult2.0.in1 60
net vel-sec <= motion.current-vel => mult2.0.in0
net vel-min <= mult2.0.out => pyvcp.mmmin
sets spindle-at-speed true
net remote-rapid-to-home halui.mdi-command-00 <= pyvcp.rapid-to-home
net remote-xy-home halui.mdi-command-01 <= pyvcp.xy-home
net remote-z-home halui.mdi-command-02 <= pyvcp.z-home
net remote-fraeser0+ halui.mdi-command-03 <= pyvcp.fraeser0+
net remote-fraeser0 halui.mdi-command-04 <= pyvcp.fraeser0
net remote-fraeser0- halui.mdi-command-05 <= pyvcp.fraeser0-
net remote-x halui.mdi-command-06 <= pyvcp.x
net remote-y halui.mdi-command-07 <= pyvcp.y
net remote-z halui.mdi-command-08 <= pyvcp.z
net remote-xyz halui.mdi-command-09 <= pyvcp.xyz
net Xpos halui.axis.0.pos-relative <= pyvcp.Xpos
net Ypos halui.axis.1.pos-relative <= pyvcp.Ypos
net Zpos halui.axis.2.pos-relative <= pyvcp.Zpos
And the [Halui] Section in my .ini File
[HALUI]
# HalUI-MDI-Befehle hier einfügen (max. 64)
MDI_COMMAND = G0 X0 Y0 Z0
MDI_COMMAND = G0 X0 Y0
MDI_COMMAND = G0 Z0
MDI_COMMAND = G0 X18.789 Y94.072
MDI_COMMAND = G0 X0 Y0
MDI_COMMAND = G0 X-18.789 Y-94.072
MDI_COMMAND = G92 X0
MDI_COMMAND = G92 Y0
MDI_COMMAND = G92 Z0
MDI_COMMAND = G92 X0 Y0 Z0
Thanks for your understanding

Greetings Fritz
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 758
Must i add the Commands in my postguil.hal like this ?
net remote-xy-home halui.mdi-command-01 <= serialcon2.xy-home
net remote-z-home halui.mdi-command-02 <= serialcon2.z-home
net remote-fraeser0- halui.mdi-command-05 <= serialcon2.fraeser0-
No.
The 'pins' you are linking do not exist, the MDI commands are already being activated by specific setp inside serialcon.
eg
system("halcmd setp halui.mdi-command-01 1");
Please Log in or Create an account to join the conversation.
- Tchefter
-
- Offline
- Elite Member
-
- Posts: 195
- Thank you received: 31
Thats what i have tried, but no Response in LinuxCNC, only my Text on the LCD changes.The 'pins' you are linking do not exist, the MDI commands are already being activated by specific setp inside serialcon.
For my Understanding:
The Key i press sends the Arduino ie. "1" to serialcon2
serialcon2 sends i.e. MDI-Command-01 with 1 to postgui.hal
postguihal. Looks what "01" is and fire up the Command that stands in the [Halui] Section...
Is that correct on the whole?
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 758
The Key i press sends the Arduino ie. "1" to serialcon2
Correct
serialcon2 sends i.e. MDI-Command-01 with 1 to postgui.hal
Wrong, postgui.hal is just a file that is processed after the GUI is built, because pyvcp pins will not have been created
until then.
serialcon executes the command which changes the state of a halui pin
postguihal. Looks what "01" is and fire up the Command that stands in the [Halui] Section...
halui looks up the MDI command which relates to the number and executes that.
Please Log in or Create an account to join the conversation.