Arduino based USB Pendant for Linuxcnc

More
18 Sep 2016 12:55 - 18 Sep 2016 13:22 #80560 by Tchefter
well, i installed the last Arduino IDE to see what port is used,
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...
Last edit: 18 Sep 2016 13:22 by Tchefter.

Please Log in or Create an account to join the conversation.

More
18 Sep 2016 13:24 #80564 by ArcEye

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.
The following user(s) said Thank You: Tchefter

Please Log in or Create an account to join the conversation.

More
18 Sep 2016 13:50 - 18 Sep 2016 13:54 #80565 by Tchefter

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 :ohmy: :ohmy: :ohmy: :lol:
Thank You ArcEye that was Problem, i forgot to change from serialcon to serialcon2

You made my Day ;) THANK YOU - God bless!
Last edit: 18 Sep 2016 13:54 by Tchefter.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 17:47 - 24 Sep 2016 17:48 #80859 by Tchefter
Since I have to wait 3-4 weeks on the 7-segment displays, to build my external DRO, I thought I build the equivalent of ArcEye's Pendant also because all the material was in the drawer. The first test went well. Now I must learn as I adjust the fields on the keypad for me and as I have the DRO display on the counterpart and in Axis at the right side. The housing consists of 4 parts 8mm black MDF. The bottom and the lid are 6mm Plexiglas.
I have installed a red / green LED: red Estop is free, green machine is on :)
Thanks again! :)
Attachments:
Last edit: 24 Sep 2016 17:48 by Tchefter.

Please Log in or Create an account to join the conversation.

More
24 Sep 2016 20:41 #80869 by Rick G
Looking Good!

Rick G
The following user(s) said Thank You: Tchefter

Please Log in or Create an account to join the conversation.

More
25 Sep 2016 09:36 #80890 by ArcEye
Very good, looks like 'The Science Museum' version of my pendant, cut away to show the workings. :laugh:
The following user(s) said Thank You: Tchefter

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 04:45 - 27 Sep 2016 04:58 #80966 by Tchefter
Hello :)
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
Last edit: 27 Sep 2016 04:58 by Tchefter.

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 07:39 #80970 by ArcEye
You can change the LCD output and the actual command activated to whatever you like.

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");

The following user(s) said Thank You: Tchefter

Please Log in or Create an account to join the conversation.

More
27 Sep 2016 08:01 #80972 by Tchefter

The 'pins' you are linking do not exist, the MDI commands are already being activated by specific setp inside serialcon.

Thats what i have tried, but no Response in LinuxCNC, only my Text on the LCD changes.

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.

More
27 Sep 2016 08:15 #80975 by ArcEye

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.
The following user(s) said Thank You: Tchefter

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds
Powered by Kunena Forum