THCAD with parallel port problems

More
16 Mar 2023 13:04 - 16 Mar 2023 13:59 #266833 by Dominik-plasma
THCAD with parallel port problems was created by Dominik-plasma
Hello!

i built a plasma cnc wíth the following components:
Dell Optiplex 960 with Linuxcnc and QTplasmac
Parallel bob db25-1205
TB6600
Nema 23 Stepper motors

The machine works fine. Now i wanted to add a THCAD - 5 to controll the torch hight.
I did the StepConf with the plasmavoltage pin to Inputpin12. An did the math for the Frequency scale and offset.

Then i hooked the THCAD to the BOB:
5v --> 5v
ground --> ground
FOUT+ --> pin 12
FOUT- --> ground

jumper at 128 devider

I didnt connect the plasma source to the THCAD because i wanted to test it first.
In the QTplasmac gui i get unstable voltage readings from - 10 to +10.
Then i connected a 1,5V batterie to the THCAD to simulate plasma voltage. Now it shows voltages between 30 to 50 V. Also very unstable.

i did a 30 min latency test which resulted about 35.000ns (base thread)
I also tried to hook the thcad directly to the parallel port of the pc, because i thought that the optocouplers may be to slow, with the same result.

anybody who has succes with thcad and parallel board?
it seems that the frequency of the thcad ist to high for my computer to read via parallel port

EDIT: this is my ini and hal file:
# Erstellt von stepconf 1.1 am Tue Feb 21 10:20:45 2023
# Änderungen an dieser Datei werden beim nächsten
# wird überschrieben wenn Sie stepconf erneut ausführen

[EMC]
MACHINE = meineplasmacnc
DEBUG = 0
VERSION = 1.1

[DISPLAY]
DISPLAY = qtvcp qtplasmac_4x3
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 200.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 200.00
CYCLE_TIME = 0.100
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/dominik/linuxcnc/nc_files
INCREMENTS = 10mm 1mm .1mm .01mm .001mm

[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ

[FILTER]
PROGRAM_EXTENSION = .ngc,.nc,.tap GCode File (*.ngc, *.nc, *.tap)
ngc = qtplasmac_gcode
nc  = qtplasmac_gcode
tap = qtplasmac_gcode

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = linuxcnc.var
RS274NGC_STARTUP_CODE = G21 G40 G49 G80 G90 G92.1 G94 G97 M52P1
SUBROUTINE_PATH = ./:../../nc_files
USER_M_PATH = ./:../../nc_files


[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 80000
SERVO_PERIOD = 1000000

[HAL]
HALUI = halui
HALFILE = meineplasmacnc.hal
HALFILE = qtplasmac_comp.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal

[TRAJ]
SPINDLES = 3
COORDINATES =  X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 200.00
MAX_LINEAR_VELOCITY = 200.00

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl

#*** AXIS_X *******************************
[AXIS_X]
# MAX_VEL & MAX_ACC need to be twice the corresponding joint value
MAX_VELOCITY = 400.0
MAX_ACCELERATION = 1400.0
OFFSET_AV_RATIO = 0.5
MIN_LIMIT = -0.001
MAX_LIMIT = 1030.0

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 1030.0
MAX_VELOCITY = 200.0
MAX_ACCELERATION = 700.0
STEPGEN_MAXACCEL = 875.0
SCALE = 22.22222222222222
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -60.000000
HOME_LATCH_VEL = 10.000000
HOME_SEQUENCE = 1
#******************************************

#*** AXIS_Y *******************************
[AXIS_Y]
# MAX_VEL & MAX_ACC need to be twice the corresponding joint value
MAX_VELOCITY = 400.0
MAX_ACCELERATION = 1400.0
OFFSET_AV_RATIO = 0.5
MIN_LIMIT = -0.001
MAX_LIMIT = 900.0

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 900.0
MAX_VELOCITY = 200.0
MAX_ACCELERATION = 700.0
STEPGEN_MAXACCEL = 875.0
SCALE = 22.22222222222222
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -60.000000
HOME_LATCH_VEL = 10.000000
HOME_SEQUENCE = 2
#******************************************

#*** AXIS_Z *******************************
[AXIS_Z]
# MAX_VEL & MAX_ACC need to be twice the corresponding joint value
MAX_VELOCITY = 60.0
MAX_ACCELERATION = 1600.0
OFFSET_AV_RATIO = 0.5
MIN_LIMIT = -68.0
MAX_LIMIT = 0.001

[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -68.0
MAX_LIMIT = 0.001
MAX_VELOCITY = 30.0
MAX_ACCELERATION = 800.0
STEPGEN_MAXACCEL = 1000.0
SCALE = 200.0
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 20.000000
HOME_LATCH_VEL = -2.500000
HOME_SEQUENCE = 0
#******************************************

# Erstellt von stepconf 1.1 am Tue Feb 21 10:20:45 2023
# Änderungen an dieser Datei werden beim nächsten
# wird überschrieben wenn Sie stepconf erneut ausführen
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=[TRAJ]SPINDLES
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0
loadrt  plasmac

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf plasmac servo-thread
addf stepgen.update-freq servo-thread

# ---PLASMA INPUT DEBOUNCE---
loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok
addf db_float     servo-thread
addf db_ohmic     servo-thread
addf db_breakaway servo-thread
addf db_arc-ok    servo-thread

# ---JOINT ASSOCIATED WITH THE Z AXIS---
net plasmac:axis-position joint.2.pos-fb => plasmac.axis-z-position

# ---PLASMA INPUTS---
# ---all modes---
net plasmac:float-switch   => db_float.in
net plasmac:breakaway      => db_breakaway.in
net plasmac:ohmic-probe    => db_ohmic.in
net plasmac:ohmic-sense-in   => plasmac.ohmic-sense-in
# ---modes 0 & 1
net plasmac:arc-voltage-in => plasmac.arc-voltage-in
# ---modes 1 & 2
net plasmac:arc-ok-in      => db_arc-ok.in
# ---mode 2
net plasmac:move-up        => plasmac.move-up
net plasmac:move-down      => plasmac.move-down

# ---PLASMA OUTPUTS---
# ---all modes---
net plasmac:ohmic-enable   <= plasmac.ohmic-enable
net plasmac:scribe-arm     <= plasmac.scribe-arm
net plasmac:scribe-on      <= plasmac.scribe-on

# ---ARC VOLTAGE ENCODER---
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
setp encoder.0.counter-mode 1
setp encoder.0.position-scale 1
net plasmac:arc-voltage-raw encoder.0.phase-A
net plasmac:arc-voltage-in encoder.0.velocity

net xdir            => parport.0.pin-02-out
setp parport.0.pin-03-out-invert 1
net xstep           => parport.0.pin-03-out
setp parport.0.pin-03-out-reset 1
net ydir            => parport.0.pin-05-out
setp parport.0.pin-06-out-invert 1
net ystep           => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1

net ydir            => parport.0.pin-04-out
setp parport.0.pin-06-out-invert 1
net ystep           => parport.0.pin-07-out
setp parport.0.pin-06-out-reset 1

setp parport.0.pin-16-out-invert 1
net plasmac:torch-on => parport.0.pin-16-out

net zdir            => parport.0.pin-08-out
setp parport.0.pin-09-out-invert 1
net zstep           => parport.0.pin-09-out
setp parport.0.pin-09-out-reset 1
setp parport.0.pin-14-out-invert 1
net xenable         => parport.0.pin-14-out
net estop-ext       <= parport.0.pin-10-in-not
net all-home        <= parport.0.pin-11-in
net plasmac:float-switch <= parport.0.pin-13-in

net plasmac:arc-voltage-raw <= parport.0.pin-12-in

setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 65000
setp stepgen.0.dirsetup 65000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable
net all-home => joint.0.home-sw-in

setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 65000
setp stepgen.1.dirsetup 65000
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable joint.1.amp-enable-out => stepgen.1.enable
net all-home => joint.1.home-sw-in

setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 65000
setp stepgen.2.dirsetup 65000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net zpos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable joint.2.amp-enable-out => stepgen.2.enable
net all-home => joint.2.home-sw-in

net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in

net tool-number <= iocontrol.0.tool-prep-number
net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared


thanks 
Dominik
Last edit: 16 Mar 2023 13:59 by Dominik-plasma.

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

More
16 Mar 2023 14:43 #266837 by andypugh
Replied by andypugh on topic THCAD with parallel port problems
The pulse frequency from the THCAD defaults to 100kHz minimum, but can be divided down for parallel port use.
Have you put a link on jumper W5 to convert it to the 781-7810Hz mode?

Have you wired it correctly for single-ended outputs? I would anticipate connecting the parport pin to OUT+ and a parport GND pin to THCAD signal GND (OUT- being left unconnected)
Thouugh you should get better noise immunity running the differential pair up to the PC and then using an RS422 to TTL interface IC at the PC end.

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

More
16 Mar 2023 15:30 #266840 by Dominik-plasma
Replied by Dominik-plasma on topic THCAD with parallel port problems
Yes, i have set the jumper to 128 devider
The parallel bob and the thcad share the same 5v power supply, so ground ist connected.
OUT- being left unconnected or connecting it to ground, make no differences.

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

More
16 Mar 2023 16:15 - 16 Mar 2023 16:16 #266843 by PCW
Replied by PCW on topic THCAD with parallel port problems
Your 12.5 KHz base thread is not fast enough to read the THCAD output
at full scale (full scale of ~8 KHz would need a >16 KHz (<62.5 usec) thread

In addition, your relatively low base thread rate reduces the
encoder velocity estimation resolution to about 1 part in 12.5

This could be improved by raising the base thread rate, lowering
the servo thread rate, or running the encoder "capture-position" function
on a slower (say 5 ms) thread
Last edit: 16 Mar 2023 16:16 by PCW.

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

More
26 Mar 2023 08:49 #267520 by Dominik-plasma
Replied by Dominik-plasma on topic THCAD with parallel port problems
Thank you, that fixed the problem!
i changed the base thread rate and optimized bios of the computer, to get a better latency. Now i have about 26000ns base thread, and i dont get any realtime delay - errors any more. i have already testet the thcad with my plasma cutter, and get good looking voltages of about 100v while cutting.

Thank you very much!

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

Time to create page: 0.077 seconds
Powered by Kunena Forum