File configuration for pendant with 6 axis on parallel port on Custom.hal

More
24 Jan 2017 22:57 #86585 by Banda68
Hi linuxcnc forum users!

I ask to you if somebody can help me about the Custum.hal configuration for a pendant moving 6 axis on LPT2

I have build my pendant using a C22 Pendant interface card buyed on cnc4pc.com following the istructions about the connections.
So I have configured the LPT2 port as input for the signals of the encoder hand whell, selection of the X1, X10,X100 and X,Y,Z A, B, C, I have buid myself the box and all connections. I test and re-test the connections pin to pin and all is correct
Please can somebody help me writing the right syntiax to check the parport LPT0 , LPT1, LPT2 on my ubuntu software?
I have digit this: lsmod | grep par

I have used my machine for long time without the pendant but now i will need it. The version of my linuxcnc control is 2.3.0.
I know is a old version but is perfectly working. So i decide no change it.

In my Custom.hal file i inserted this code:

# Jog Pendant
loadrt encoder num_chan=1
loadrt mux4 count=1
loadrt mult2 count=1


addf encoder.capture-position servo-thread
addf encoder.update-counters base-thread
addf mux4.0 servo-thread
addf mult2.0 servo-thread


# If your MPG outputs a quadture signal per click set x4 to 1
# If your MPG puts out 1 pulse per click set x4 to 0
setp encoder.0.x4-mode 0

# For velocity mode, set n to 1
# In velocity mode the axis stops when dial is stopped even if that means
# the commanded motion is not completed,
# For position mode (the default), set n to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
# This must be set for each axis you want to behave other than default

setp axis.0.jog-vel-mode 0
setp axis.1.jog-vel-mode 0
setp axis.2.jog-vel-mode 0
setp axis.3.jog-vel-mode 0
# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.01
setp mux4.0.in1 0.001
setp mux4.0.in2 0.0001
setp mux4.0.in3 100

#setp mult2.0.in3 1.00

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= parport.2.pin-09-in
net scale2 mux4.0.sel1 <= parport.2.pin-08-in
#net scale2 mux4.0.sel2 <= parport.2.pin-10-in # BL


# The output from the mux4 is sent to each axis jog scale
net pend-scale axis.0.jog-scale <= mux4.0.out
net pend-scale axis.1.jog-scale
net pend-scale axis.2.jog-scale
#net pend-scale mult2.0.in1 #BL
net rot-scale axis.3.jog-scale <= mult2.0.out #BL Rotative Axis A
#net rot-scale axis.4.jog-scale <= mult2.1.out #BL Rotative Axis B
#net rot-scale axis.5.jog-scale <= mult2.2.out #BL Rotative Axis C

# The MPG inputs
net mpg-a encoder.0.phase-A <= parport.2.pin-02-in
net mpg-b encoder.0.phase-B <= parport.2.pin-03-in

# The Axis select inputs
net mpg-x axis.0.jog-enable <= parport.2.pin-04-in
net mpg-y axis.1.jog-enable <= parport.2.pin-05-in
net mpg-z axis.2.jog-enable <= parport.2.pin-06-in
#net mpg-a axis.3.jog-enable <= parport.2.pin-07-in #BL Rotative Axis A (If activate I have errors
#net mpg-a axis.4.jog-enable <= parport.2.pin-12-in #BL Rotative Axis B
#net mpg-a axis.5.jog-enable <= parport.2.pin-13-in #BL Rotative Axis C



net pend-counts axis.0.jog-counts <= encoder.0.counts
net pend-counts axis.1.jog-counts
net pend-counts axis.2.jog-counts
net pend-counts axis.3.jog-counts
net pend-counts axis.4.jog-counts
net pend-counts axis.5.jog-counts

# END Of file


I flagged with #BL the command lines where i have the error starting the software.
So this is the reason because each line with #BL is commented with# for no generate errors.
In this way the software start and work normally with all functions.
But the pendant no move any axis included X,Y,Z wich are not commented by # (Normal line)
So this is the real problem too. In teory those axis will move. Any suggestions?

I know i have some mistakes in this file....but i don't know how i can write it correctly especially for A,B,C axis
Please can somebody help me to solve it?
If somebody can correct my file i will apprecciate a lot!!

Many Thanks for Your great Help!!
Kind Regards!
Luciano from Italy!!

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

More
25 Jan 2017 11:35 #86605 by tommylight
Salve Luciano,
There is nothing after the LSMOD GREP command, please attach the output of that,
and are you sure you have 3 parallel ports on that computer?
Your custom hal looks ok if you actualy have 3 ports, but you need to add some lines to the main hal file ( the one with the name of your config ), namely youo have to loadrt paraport 2 as IN, and add the READ and WRITE lines for that paraport.
Ciao,
Tom

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

More
25 Jan 2017 23:06 #86657 by Banda68
Dear Tommy Many Thanks for your great Support and so quick answer to me!!!!

In Attachement You can see the Parport configuration of my machine.
Too I attacched My .HAL file where for sure i setted my LPT2 port.

Checking my machine today i test too the "Show Hal Configuration" menu > Pins> Parport.
About Parport 0 and Parport 1 (LPT0 and LPT1) selecting "Show" I can see all parameter and the right configuration for sure. In
"Watch" I can see the real time status of each input and output with the yellow lamp going red when the input or the output go true. So about LPT0 and LPT1 OK. Any problem for sure!

About Parport 2 (LPT2) selecting "Show" I can see all parameter and the configuration for sure like in my Custom.hal file
.
If I select "Watch" I can't see any yellow lamp real time status of each input. Anythings is in this mask. Totally empty...So I can't see the yellow lamp going red when the input go true.... I think this is the real problem.

I have inverted the LPT1 and LPT2 hardware card for check if the hardware have problems.

So I connected on LPT2 card the cable with 25 DB connector normally used on my good LPT1 to drive the hardware of axis C and B.
The machine work properly without any problem. So the card wich i will use like LPT2 is good and working but for sure at the address 0xec00 (LPT1)

How You can see on my .HAL file I have inserted 3 Hex addresses: loadrt hal_parport cfg="0x378 0xec00 0x278 in"
What You think about those adrresses comparing the answer of the command LSMOD Grep attached in the file?

luciano@luciano-desktop:~$ lsmod | grep
parport 33224 2 ppdev,lp

I think my mistake is around here... but if you can help me I will apprecciate a lot!!!!

I really hope I give to You all informations but if necessary i will back to you some more informations following your instructions.
GRAZIE MILLE!!!
Ciao a presto!
Many Thanks for your Time and Courtesy!!
Luciano



File Attachment:

File Name: Lsmodgrep.doc
File Size:4 KB

File Attachment:

File Name: CARLOTTA.hal
File Size:7 KB
Attachments:

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

More
25 Jan 2017 23:49 #86665 by tommylight
Salve Luciano,
Some advice
----do not use microsoft word to edit HAL and INI files, use Notepad or edit them in Linux only
----the address of the paraport no2 ( third ) can not be 0x278, that is reserved for onboard ports
----no .doc files, i usualy reply from phone so i can not open it, use txt files
---- you can use 0 or 1 or 2 for addresses , so you can have this
Loadrt hal_paraport "0 out 1 out 2 in" instead of loadrt hal_parport cfg="0x378 0xec00 0x278 in"
But this can switch places for add on paraports so you have to check the numbering.
The hal file you attached has some wierd signs like A with something above it !
Try this and let us know how it goes.
The following user(s) said Thank You: Banda68

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

More
26 Jan 2017 00:20 #86668 by Banda68
Ciao Tommy!
Many Thanks for your so quick answer!
Please apologize me about the text editor. I Understand and from now I will follow your suggestions.
My editor for files is Notepad++ but is true for the attached files i used .doc files. So Sorry for this!!

Many Thanks for the suggestions about the line Loadrt hal_paraport "0 out 1 out 2 in" I Understand your suggestion.
Tomorrow morning I will test this new command line and for sure i will advise you again.

About the files attached with strange A I understand the reason. I do a copy paste of the screen on ubuntu and save it. Than I open it with my windows computer and the text editor ask me about the font. So this is the reason... OK Grazie for the suggestion

Grazie Tommy I will write you back soon is possible after cecked my pendant tomorrow.
Now is 1.00 Am in the morning here in Italy.
A Presto
Luciano

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

More
26 Jan 2017 22:03 #86743 by Banda68
Ciao Tommy!!
How promise to You today i try again on my machine following your suggestions of yesterday.
So finally I found the trouble and i have well configurate the LPT2 .

With the command: lspci -v i had this result

03:00.0 Communication controller: NetMos Technology PCI 1 port parallel adapter (rev 01)
Subsystem: LSI Logic / Symbios Logic Unknown device 0010
Flags: medium devsel, IRQ 5
I/O ports at ec00
I/O ports at e880
I/O ports at e800
I/O ports at e480
I/O ports at e400
I/O ports at e080

03:01.0 Parallel controller: Timedia Technology Co Ltd Unknown device 7268 (rev 01) (prog-if 02 [ECP])
Subsystem: Timedia Technology Co Ltd Unknown device 0103
Flags: stepping, medium devsel, IRQ 10
I/O ports at e000
I/O ports at dc00

So in my machin.HAL i setted:
loadrt hal_parport cfg="0x378 0xec00 0xe000 in"

Checking my machine today i test too the "Show Hal Configuration" menu > Pins> Parport
I can see in the real time the yellow led of the input going to on changing color in red. So the input listed in my Custom.hal are working and i can see the change of the status. X,Y,Z,A input selection is ok but when i select axis "B" or axis "C" i can see the
parport.2.pin-12-in
parport.2.pin-13-in
becames ON or OFF toghther at the same time....
I checked several times my connections from the pendant to the DB25 male connector tothe LPT2 port and all wires are well connected. For sure i respect each pin like the CUSTOM.hal file!!
Can be this a trouble becames from a wrong setting in the Custom.hal file?

For sure i move too my rotative encoder in both directions and the axis are moving.
But I have this PROBLEM again....
I checked several times my connections from the pendant to the DB25 male connector tothe LPT2 port and all wires are well connected. For sure i respect each pin like the CUSTOM.hal file!!

I have this trouble:
for example if I select the position "X" axis i can see the moviment of "Y+Z" axis togheter contemporanely....
for example if I select the position "Y" axis i can see the moviment of "X+Z" axis togheter contemporanely....
for example if I select the position "Z" axis i can see the moviment of "Y+Z" axis togheter contemporanely....

The axis "A, B, C," no move anytime moving the encoder whell.
The strange is about the input X,Y,Z,A are well working in the test input "Watch" . Those going ON or OFF one by one separatly but the axis move togheter like i described above.
Please can You check my Custom.hal file if have any error or errors or you suggest to write different sometings?
I think the mistake can be there because I try to set it for 6 axis starting from the MPEG Pendant sample on the user manual. So for sure i make some mistakes.... Please apologize me !!

This is my Custom.hal file at the last revision:
# START OF MY Custom.hal file

# Jog Pendant
loadrt encoder num_chan=1
loadrt mux4 count=1
loadrt mult2 count=1

addf encoder.capture-position servo-thread
addf encoder.update-counters base-thread
addf mux4.0 servo-thread
addf mult2.0 servo-thread

# If your MPG outputs a quadture signal per click set x4 to 1
# If your MPG puts out 1 pulse per click set x4 to 0
setp encoder.0.x4-mode 0

# For velocity mode, set n to 1
# In velocity mode the axis stops when dial is stopped even if that means
# the commanded motion is not completed,
# For position mode (the default), set n to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
# This must be set for each axis you want to behave other than default

setp axis.0.jog-vel-mode 0
setp axis.1.jog-vel-mode 0
setp axis.2.jog-vel-mode 0
setp axis.3.jog-vel-mode 0
setp axis.4.jog-vel-mode 0
setp axis.5.jog-vel-mode 0

# This sets the scale that will be used based on the input to the mux4

setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001


#setp mult2.0.in3 1.00

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= parport.2.pin-09-in
net scale2 mux4.0.sel1 <= parport.2.pin-08-in
#net scale2 mux4.0.sel2 <= parport.2.pin-10-in BL
#net scale2 mux4.0.sel3 <= parport.2.pin-11-in BL

# The output from the mux4 is sent to each axis jog scale
net pend-scale axis.0.jog-scale <= mux4.0.out
net pend-scale axis.1.jog-scale
net pend-scale axis.2.jog-scale
#net pend-scale mult2.0.in1 BL
net rot-scale axis.3.jog-scale <= mult2.0.out #BL Asse rotativo A
net rot-scale axis.4.jog-scale <= mult2.0.out #BL Asse rotativo B
net rot-scale axis.5.jog-scale <= mult2.0.out #BL Asse rotativo C

# The MPG inputs
net mpg-a encoder.0.phase-A <= parport.2.pin-02-in
net mpg-b encoder.0.phase-B <= parport.2.pin-03-in

# The Axis select inputs
net mpg-x axis.0.jog-enable <= parport.2.pin-04-in
net mpg-y axis.1.jog-enable <= parport.2.pin-05-in
net mpg-z axis.2.jog-enable <= parport.2.pin-06-in
net mpg-4 axis.3.jog-enable <= parport.2.pin-07-in
net mpg-5 axis.4.jog-enable <= parport.2.pin-12-in
net mpg-6 axis.5.jog-enable <= parport.2.pin-13-in


net pend-counts axis.0.jog-counts <= encoder.0.counts
net pend-counts axis.1.jog-counts
net pend-counts axis.2.jog-counts
net pend-counts axis.3.jog-counts
net pend-counts axis.4.jog-counts
net pend-counts axis.5.jog-counts

End of Custom.hal FILE

Please apologize me for the english no so perfect..
Many Thanks to You for your Courtesy!!
I'm Very Happy for the progress of today on my machine!

Grazie ancora!!
Kind Regards
a presto
Luciano

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

Time to create page: 0.217 seconds
Powered by Kunena Forum