summaryrefslogtreecommitdiff
path: root/docs/src/examples/mpg_es.txt
blob: 20e1a605a7b96b59f1e0d8e566aaead932e393e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
= MPG Pendant

////
ATTENTION TRANSLATORS before translating this document copy the base document
into this copy to get the latest version. Untranslated documents are not kept
up to date with the English documents. 

Do not translate anchors or links, translate only the text of a link after the
comma.
Anchor [[anchor-name]]
Link <<anchor-name,text after the comma can be translated>>

Make sure the documents build after translating.
////

This example is to explain how to hook up the common MPG pendants
found on the market today. This example uses an MPG3 pendant and a
C22 pendant interface card from CNC4PC connected to a second parallel
port plugged into the PCI slot. This example gives you 3 axes with 3
step increments of 0.1, 0.01, 0.001

In your custom.hal file or other.hal file add the following, making
sure you don't have mux4 or an encoder already in use. If you do just
increase the counts and change the reference number. More information
about mux4 and encoder can be found in the HAL manual. 

----
# Jog Pendant 
loadrt encoder num_chan=1 
loadrt mux4 count=1 
addf encoder.capture-position servo-thread 
addf encoder.update-counters base-thread 
addf mux4.0 servo-thread

# If your MPG outputs a quadrature 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 the 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 in velocity mode 
setp axis.N.jog-vel-mode n

setp mux4.0.in0 0.1 
setp mux4.0.in1 0.01 
setp mux4.0.in2 0.001 
net scale1 mux4.0.sel0 <= parport.1.pin-09-in 
net scale2 mux4.0.sel1 <= parport.1.pin-10-in 
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 mpg-a encoder.0.phase-A <= parport.1.pin-02-in 
net mpg-b encoder.0.phase-B <= parport.1.pin-03-in 
net mpg-x axis.0.jog-enable <= parport.1.pin-04-in 
net mpg-y axis.1.jog-enable <= parport.1.pin-05-in 
net mpg-z axis.2.jog-enable <= parport.1.pin-06-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
----