EVENT / TIMER and "DDE"
bevor: my english is not very good
i have 1 Laser (1500 w) and emc2 retrofit ... its runnig now "ok" ...
the laserpower on the edges and so ... ist sometimes to MUCH ...
to control the power i have a 0 ... 5 VOLT analog signal and i will
make this allways in relation to the feed/velocity but not 1 : 1
to control this i have no idea
with G-code i can send M123 P50 or antything but this is not perfekt
...
my "home" was bevor emc2 >>> win / visualstudio and visualbasic to make good programms
now i was a ~freshman~
=====================================
can i make a "Timer-Event" at EMC2 ?
or
can i give signals at all 20 ms out to a C or python ?
OR
can i make a "DDE" / tcp / or any from python to EMC2 and look to the aktual FEED
very thanks for a little input
Please Log in or Create an account to join the conversation.
o control the power i have a 0 ... 5 VOLT analog signal and i will
make this allways in relation to the feed/velocity but not 1 : 1
I think you need to look to doing some processing in the HAL.
www.linuxcnc.org/docview/html/hal_basic_hal.html
You should be able to use the motion.current-vel HAL pin to modulate the laser power.
This might give you enough flexibility, it uses the G-code S-word (spindle speed) to control laser power. You will need to hook up the mult2.0.out pin to whatever currently controls the laser power. The example assumes a pwm generator exists.
loadrt scale count=2
loadrt mult2 count =1
…
addf scale.0.servo-thread
addf scale.1 servo-thread
addf mult2.0 servo-thread
…
net speed-in motion.current-vel => scale.0.in
#choose these numbers to suit
setp scale.0.gain 0.1
setp scale.0.offset -0.5
net power-in motion.spindle-speed-out => scale.1.in
#choose these numbers to suit
setp scale.1.gain 0.1
setp scale.1.offset -0.5
net scaled-speed scale.0.out => mult2.0.in0
net scaled-power scale.1.out => mult2.0.in1
net output-power mult2.0.out => pwmgen.0.in
I use VBA an awful lot, but managed to get the hang of HAL and C.my "home" was bevor emc2 >>> win / visualstudio and visualbasic to make good programms
now i was a ~freshman~
Yes, but we would need more details about what you want, there are so many ways to do it.can i make a "Timer-Event" at EMC2
Please Log in or Create an account to join the conversation.
i not sure - the POWER goes 1:1 form speed to "spindle speed" (the laser is for me begining)
i think:
Sample: Stainless 2 mm tickness ...
i give this to g-code:
F = 3000 mm / min
Prim.Power = 750 WATT = now 100%
and send to begin from cuting an Mnnn to start the "Spindle-speed"
then the power goes upAnddown / speed but not under ~2000
i think with spindle-speed.MIN = 2000 # ( ~> 375 W / 50% : F3000 = 100% or 2000 = 0% and 3000 = 100% from RANGE 375W)
the 1:1 was ok
=====================
can i make a "Timer-Event" at EMC2Yes, but we would need more details about what you want, there are so many ways to do it.
=====================
the timer event was my think to send a output to python and i give inside Py the power to laser
now my wife is on POWER and i must out
thanks for help
Please Log in or Create an account to join the conversation.
Yes, if you say M3 S1234.567 then the HAL "pin" called motion.spindle-speed-out takes the value 1234.567POWER goes 1:1 form speed to "spindle speed" (the laser is for me begining)
Also, the M3 makes the pin motion.spindle-on take on the value "TRUE"
You need to be careful about the types of pins. They can either be integer, floating point or boolean and you can't "wire" "pins" of different types together.
Please Log in or Create an account to join the conversation.
ok its 1:1 ...
i "found" this on "wiki.linuxcnc.org/emcinfo.pl?Using_HAL_In_Python"
===========
DESCRIPTION
This module allows the creation of userspace HAL components in Python.
This includes pins and parameters of the various HAL types.
Typical usage:
import hal, time
h = hal.component("component-name")
# create pins and parameters with calls to h.newpin and h.newparam
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready() # mark the component as 'ready'
try:
while 1:
# act on changed input pins; update values on output pins
time.sleep(1)
h = h
except KeyboardInterrupt: pass
When the component is requested to exit with 'halcmd unload', a
KeyboardInterrupt exception will be raised.
DATA
HAL_BIT = 1
HAL_FLOAT = 2
HAL_IN = 16
HAL_IO = 48
HAL_OUT = 32
HAL_RO = 64
HAL_RW = 192
HAL_S32 = 3
HAL_U32 = 4
==============
i have see the time.sleep(1) (one Sec or MS ?) and this was verry good
when i can make this:
the sample goes to M123
on cut-begin: Nxxx M123 2000 # Watt 100% for powerfeed ON
then i can control the power in the event from the python-file ? every 1 ms
on cut-end Nxxx M124
bevor i can't sleep tonight
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) # makes a newpin ?
can i make a question to M5i20 pins from the event from python ?
*smile*
Please Log in or Create an account to join the conversation.
This module allows the creation of userspace HAL components in Python.
I have no idea what you are trying to do, but I doubt that you want a userspace component for timing.
Have a look at:
linuxcnc.org/docs/html/hal_comp.html
And maybe:
wiki.linuxcnc.org/emcinfo.pl?SimpleCycleTimer
Can you explain what you want this timer to do?
If you want to do something every 1mS then do it in the HAL file, in the servo thread, then it happens absolutely certainly every 1mS.
The HAL example I gave earlier will update the power output every 1mS, based on the current cartesian velocity, and allows you to set laser power using S rather than M123.
Please Log in or Create an account to join the conversation.
ok its 1:1 ...
i "found" this on "wiki.linuxcnc.org/emcinfo.pl?Using_HAL_In_Python"
===========
DESCRIPTION
This module allows the creation of userspace HAL components in Python.
This includes pins and parameters of the various HAL types.
Typical usage:
import hal, time
h = hal.component("component-name")
# create pins and parameters with calls to h.newpin and h.newparam
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready() # mark the component as 'ready'
try:
while 1:
# act on changed input pins; update values on output pins
time.sleep(1)
h = h
except KeyboardInterrupt: pass
When the component is requested to exit with 'halcmd unload', a
KeyboardInterrupt exception will be raised.
DATA
HAL_BIT = 1
HAL_FLOAT = 2
HAL_IN = 16
HAL_IO = 48
HAL_OUT = 32
HAL_RO = 64
HAL_RW = 192
HAL_S32 = 3
HAL_U32 = 4
==============
i have see the time.sleep(1) (one Sec or MS ?) and this was verry good
when i can make this:
the sample goes to M123
on cut-begin: Nxxx M123 2000 # Watt 100% for powerfeed ON
then i can control the power in the event from the python-file ? every 1 ms
on cut-end Nxxx M124
bevor i can't sleep tonight
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) # makes a newpin ?
can i make a question to M5i20 pins from the event from python ?
*smile*
Please Log in or Create an account to join the conversation.
nearly its verry good
but i don't understand the correct way to give 0 to 5 V out correctly
#############################################
# Spindelsteuerung mit Pulsweitenmodulation
# es gibt 3 Typen, 0, 1 , 2
# Hierbei ist 1 der Typ mit Richtungssignal
# PWM Spindle Control
# there are 3 types
# beeing 1 with direction signal
#############################################
# PWM Signal Erzeugung / Setup PWM Generator signals
# setp hm2_5i20.0.pwmgen.02.output-type 1 # not sure for me ...
# setp hm2_5i20.0.pwmgen.02.scale 1000
setp hm2_5i20.0.pwmgen.02.enable 1
loadrt scale count=2
loadrt mult2 count=1
addf scale.0 servo-thread
addf scale.1 servo-thread
addf mult2.0 servo-thread
net speed-in motion.current-vel => scale.0.in
#choose these numbers to suit
setp scale.0.gain 0.1
setp scale.0.offset 0.5
net power-in motion.spindle-speed-out => scale.1.in
#choose these numbers to suit
setp scale.1.gain 1500
setp scale.1.offset 0.5
net scaled-speed scale.0.out => mult2.0.in0
net scaled-power scale.1.out => mult2.0.in1
# net output-power mult2.0.out => pwmgen.0.in
net output-power mult2.0.out => hm2_5i20.0.pwmgen.02.value => gladevcp.hal_meter1
when 1500 W = 100% Power for the 100% Speed (gives the F param in the g-code)
and the V = 0 to 5 V
i think: Scale = 5 / 1500
...
i have make ~50 or more examples *g* combined sourceA / b c..d... etc. now i am deffekt ...
====
importend for me is this:
LaserPower to SET -> ON and OFF in Gcode
when i can set a min and maxRange for the speed-laser-powercontrol then i don't set a alternativ for allways the Snnn Power
otherwise i will make
GCodeA: with controled
N10 M123 1 # >>> set controlled-speed ON
N12 F100
N14 M124 S100 #LASER ON to 100W
N16 S750 # maybe: = 750 WATT or 50% or 2.5 V
N18 G1 X10 Y10 ..... # work controlled with speed
....
N200 M125 # LASER OFF its then Volt = 0 or the pin to enable = false ? good-think
GCodeB: with not controled
N10 M123 0 # >>> set controlled-speed OFF
N12 F100
N14 M124 S100 #LASER ON to 100W
N16 S750 # maybe: = 750 WATT or 50% or 2.5 V
N18 G1 X10 Y10 ..... # work allways with 750 WATT
....
N200 M125 # LASER OFF its then Volt = 0 or the pin to enable = false ? good-think
=========
i am not sure why the hm2_5i20.0.pwmgen.02.value = 3 but the Volts is not 3 *g*
verry thanks for a help next
Please Log in or Create an account to join the conversation.
It probably doesn't matter, but you might want to uncomment these linesbut i don't understand the correct way to give 0 to 5 V out correctly
...
# setp hm2_5i20.0.pwmgen.02.output-type 1 # not sure for me
# setp hm2_5i20.0.pwmgen.02.scale 1000 ...
If you have pwmgen scale = 1500 then a value of 1500 on the pwmgen.value pin will give you 100% duty cycle.
What voltage that is depends on what the pwmgen is connected to.
when 1500 W = 100% Power for the 100% Speed (gives the F param in the g-code)
and the V = 0 to 5 V
i think: Scale = 5 / 1500
No, the pwmgen only goes between 0% and 100%. The output voltage depends on the pwm to voltage conversion circuit. What are you using?
Also, the example code I gave adds some more factors and offsets, which will complicate matters.
In the sample I gave, you should be able to turn the laser on with M3 and off with M5, just like a spindle.LaserPower to SET -> ON and OFF in Gcode
What does your M123 command do?
It ought to work. it depends on your physical wiring, ie how the laser is connected to the computer.N200 M125 # LASER OFF its then Volt = 0 or the pin to enable = false ? good-think
Please Log in or Create an account to join the conversation.
its ok
with M3 i set it ON and give the 100%
M3 S1500 gives 100% = 1500 ?
now when the speed goes to 50% the output = 50% = 750 = 2.5 V ?
...
M5 set Spindel OFF - verry good ...its ok
i make this now on the machine ... and
i 'l be come back
Please Log in or Create an account to join the conversation.