emcoturn 120 / 220 tool turret hal outputs

More
23 Jul 2019 20:37 #140351 by Erikcnc
Hi all,

From some one on youtube i got some files for getting the original emco 120 / 220 tool turret working.
its uses a 24v dc motor and the original encoder with 4 optos.
The motor is driven by a L298N motor module.

today i discovered that almost the same files where here on the forum. i used the comp file because i was missing that one.

wiki.linuxcnc.org/cgi-bin/wiki.pl?Contri...oolchanger_component

the only thing i struggle with is wiring the motor module.
In the hal file i got they go like
net forward_out pwmgen.0.pwm => hm2_5i25.0.gpio.005.out

i am not fermilair with the gpio outputs.
i am using the mesa 7i76e as far i know it does not have gpio pins.

could some one help me out with this?

##EMCOTC
loadrt pwmgen output_type=0,0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses servo-thread
setp pwmgen.0.pwm-freq 500.0
setp pwmgen.0.scale 100.0
setp pwmgen.0.offset 0.0
setp pwmgen.1.pwm-freq 500.0
setp pwmgen.1.scale 100.0
setp pwmgen.1.offset 0.0

loadrt emcochanger
addf emcochanger servo-thread

loadrt timedelay count=1
addf timedelay.0 servo-thread

# will wait 5 secs approx and turn motor off after reversing against stop
setp timedelay.0.on-delay 2

net tool-change iocontrol.0.tool-change => emcochanger.toolchange
net tool-changed iocontrol.0.tool-changed <= emcochanger.toolchanged
net tool-number iocontrol.0.tool-prep-number => emcochanger.toolnumber
net tool-oldnumber iocontrol.0.tool-number => emcochanger.currenttoolnumber
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

net sig1 emcochanger.opto1 <= hm2_5i25.0.7i76.0.0.input-16
net sig2 emcochanger.opto2 <= hm2_5i25.0.7i76.0.0.input-17
net sig3 emcochanger.opto3 <= hm2_5i25.0.7i76.0.0.input-18
net sig4 emcochanger.opto4 <= hm2_5i25.0.7i76.0.0.input-19

setp hm2_5i25.0.gpio.004.is_output true
setp hm2_5i25.0.gpio.005.is_output true

#net sig-forward emcochanger.forward => hm2_5i25.0.gpio.005.out
#net sig-backward emcochanger.backward => hm2_5i25.0.gpio.004.out

setp pwmgen.0.enable true
setp pwmgen.1.enable true

net forward_motor pwmgen.0.value <= emcochanger.forwardpwm
net forward_out pwmgen.0.pwm => hm2_5i25.0.gpio.005.out

net backward_motor pwmgen.1.value <= emcochanger.backwardpwm
net backward_out pwmgen.1.pwm => hm2_5i25.0.gpio.004.out

net delaystart timedelay.0.in <= emcochanger.delaystart
net delaydone timedelay.0.out => emcochanger.delaydone
##EMCOTC

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

More
24 Jul 2019 12:03 #140423 by BigJohnT
The 7i76e output pins have names like hm2_7i76e.0.7i76.0.0.output-00. Run an Axis config and show hal configuration will show all the pin names.

JT
The following user(s) said Thank You: Erikcnc

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

More
24 Jul 2019 12:50 - 24 Jul 2019 12:51 #140426 by Erikcnc

The 7i76e output pins have names like hm2_7i76e.0.7i76.0.0.output-00. Run an Axis config and show hal configuration will show all the pin names.

JT


Thanks JT.

I am familair with these DO pins.
As far i saw on the video on youtube, the IN1 and IN2 of the L298n board are conected to 3rd row for a step/dir config.
The L298n needs 5v inputs, instead of the 24v thats coming out of the Digital outputs pins...I am a little bit concern that i am coing to blow thins up with that.

So i tried the hal file i get from the forum.
###############Toolchanger#########################

loadrt emcochanger
addf emcochanger servo-thread

loadrt timedelay count=2
addf timedelay.0 servo-thread
# will wait 2 secs approx and turn motor off after reversing against stop
setp timedelay.0.on-delay 0.8

#Toolchanger delay time before reverse lock
addf timedelay.1 servo-thread
setp timedelay.1.on-delay 0.2


net tool-change iocontrol.0.tool-change => emcochanger.toolchange
net tool-changed iocontrol.0.tool-changed <= emcochanger.toolchanged
net tool-number iocontrol.0.tool-prep-number => emcochanger.toolnumber
net tool-oldnumber iocontrol.0.tool-number => emcochanger.currenttoolnumber
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

net sig1 emcochanger.opto1 <= hm2_7i76e.0.7i76.0.0.input-21
net sig2 emcochanger.opto2 <= hm2_7i76e.0.7i76.0.0.input-22
net sig3 emcochanger.opto3 <= hm2_7i76e.0.7i76.0.0.input-23
net sig4 emcochanger.opto4 <= hm2_7i76e.0.7i76.0.0.input-24

#direction signal for toolchanger
net sig-forward emcochanger.forward =>hm2_7i76e.0.7i76.0.0.output-01

#run signal for toolchanger
net x-enable => pwmgen.0.enable
net pwmgen_value pwmgen.0.value <= emcochanger.setpwm
net pwmgen_out pwmgen.0.pwm => hm2_7i76e.0.7i76.0.0.output-02

setp hm2_7i76e.0.7i76.0.0.output-00.invert 1
setp hm2_7i76e.0.7i76.0.0.output-01.invert 1


net xhomed axis.0.homed => emcochanger.ishomedX
net zhomed axis.2.homed => emcochanger.ishomedZ

net delaystart timedelay.0.in <= emcochanger.delaystart
net delaydone timedelay.0.out => emcochanger.delaydone

net delaystart1 timedelay.1.in <= emcochanger.delaystart1
net delaydone1 timedelay.1.out => emcochanger.delaydone1

# if the delay is too long in switching relays for forward and reverse
# setp emcochanger.times 300
# for instance will make it shorter, default is 500 - about 1-2 secs on my system

I set this up for my mesa 7i76e, just to test it out if its working.

I changed
#direction signal for toolchanger
net sig-forward emcochanger.forward => parport.0.pin-16-out

#run signal for toolchanger
net x-enable => pwmgen.0.enable
net pwmgen_value pwmgen.0.value <= emcochanger.setpwm
net pwmgen_out pwmgen.0.pwm => parport.0.pin-17-out

setp parport.0.pin-14-out-invert 1
setp parport.0.pin-16-out-invert 1

In to:
#direction signal for toolchanger
net sig-forward emcochanger.forward =>hm2_7i76e.0.7i76.0.0.output-01

#run signal for toolchanger
net x-enable => pwmgen.0.enable
net pwmgen_value pwmgen.0.value <= emcochanger.setpwm
net pwmgen_out pwmgen.0.pwm => hm2_7i76e.0.7i76.0.0.output-02

setp hm2_7i76e.0.7i76.0.0.output-00.invert 1
setp hm2_7i76e.0.7i76.0.0.output-01.invert 1

Now i am getting error

hal:62: pin ' pwmgen.0.enable' does not exist.
Attachments:
Last edit: 24 Jul 2019 12:51 by Erikcnc.

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

More
24 Jul 2019 13:06 #140428 by tommylight
L298 does not have current limiting so attaching it directly to step/dir pins will most probably cause it to fail as soon as a change in direction is issued.
Consult PCW about having a PWM output on step/dir pins.

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

More
24 Jul 2019 14:41 - 24 Jul 2019 14:42 #140432 by PCW
Yes, if you want 5V PWM pins, you should use a hardware PWMGen on the step/dir pins
or on the 7I76E's expansion port , perhaps with a low cost 5V breakout board to buffer/protect the 7I76E pins
Last edit: 24 Jul 2019 14:42 by PCW.
The following user(s) said Thank You: Erikcnc

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

More
24 Jul 2019 14:56 - 24 Jul 2019 15:23 #140434 by Erikcnc

Yes, if you want 5V PWM pins, you should use a hardware PWMGen on the step/dir pins
or on the 7I76E's expansion port , perhaps with a low cost 5V breakout board to buffer/protect the 7I76E pins



Thanks! that is what i was thinking of. Only can't figure out what line to use?
What are the pins being called to make this work?
Last edit: 24 Jul 2019 15:23 by Erikcnc.

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

More
24 Jul 2019 16:35 #140439 by Mike_Eitel
LM298 chip has sense resistors pins that alow to measure and limit motor current. The logic input pins are ttl level.
Togeather with LM297 it allows to make your own "Stepper driver".
But that gives not a fun solution... Been there years agoo ;-(
Mike

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

More
24 Jul 2019 16:47 #140440 by PCW
First you would need firmware that has a a hardware PWM generator,
Then you would need to setup that hardware PWM generator

You would also need to be careful about the startup state of the PWM
pins

What interface pins do you need?
The following user(s) said Thank You: Erikcnc

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

More
24 Jul 2019 21:35 - 24 Jul 2019 21:40 #140477 by Erikcnc

First you would need firmware that has a a hardware PWM generator,
Then you would need to setup that hardware PWM generator

You would also need to be careful about the startup state of the PWM
pins

What interface pins do you need?


hmm. didn`t expect to do everything on the firmware with chance to ruining it.

i prefer to use the stepgen outputs.
Actually i prefer the best solution. I thought this whats a easy solution in stead of the toolerator3000 option.:(

if you watch this, you see at 2:20 two wires that goes from the l298n module to the mesa .




His hal file is different then i got from theisforum.

##EMCOTC
loadrt pwmgen output_type=0,0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses servo-thread
setp pwmgen.0.pwm-freq 500.0
setp pwmgen.0.scale 100.0
setp pwmgen.0.offset 0.0
setp pwmgen.1.pwm-freq 500.0
setp pwmgen.1.scale 100.0
setp pwmgen.1.offset 0.0

loadrt emcochanger
addf emcochanger servo-thread

loadrt timedelay count=1
addf timedelay.0 servo-thread

# will wait 5 secs approx and turn motor off after reversing against stop
setp timedelay.0.on-delay 2

net tool-change iocontrol.0.tool-change => emcochanger.toolchange
net tool-changed iocontrol.0.tool-changed <= emcochanger.toolchanged
net tool-number iocontrol.0.tool-prep-number => emcochanger.toolnumber
net tool-oldnumber iocontrol.0.tool-number => emcochanger.currenttoolnumber
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

net sig1 emcochanger.opto1 <= hm2_5i25.0.7i76.0.0.input-16
net sig2 emcochanger.opto2 <= hm2_5i25.0.7i76.0.0.input-17
net sig3 emcochanger.opto3 <= hm2_5i25.0.7i76.0.0.input-18
net sig4 emcochanger.opto4 <= hm2_5i25.0.7i76.0.0.input-19

setp hm2_5i25.0.gpio.004.is_output true
setp hm2_5i25.0.gpio.005.is_output true

#net sig-forward emcochanger.forward => hm2_5i25.0.gpio.005.out
#net sig-backward emcochanger.backward => hm2_5i25.0.gpio.004.out

setp pwmgen.0.enable true
setp pwmgen.1.enable true

net forward_motor pwmgen.0.value <= emcochanger.forwardpwm
net forward_out pwmgen.0.pwm => hm2_5i25.0.gpio.005.out

net backward_motor pwmgen.1.value <= emcochanger.backwardpwm
net backward_out pwmgen.1.pwm => hm2_5i25.0.gpio.004.out

net delaystart timedelay.0.in <= emcochanger.delaystart
net delaydone timedelay.0.out => emcochanger.delaydone
##EMCOTC
Attachments:
Last edit: 24 Jul 2019 21:40 by Erikcnc.

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

More
24 Jul 2019 22:07 - 24 Jul 2019 22:38 #140479 by PCW
You cannot do 500 Hz PWM with the 7I76E field outputs so a firmware change is required

There is not any real risk of bricking the 7i76E unless you write an incorrect file to both EEPROMS

If you only need 2 PWM signals and you don't need all 5 stepgens, the easiest way to get these signals is
to "steal" the last (04) stepgen pins with firmware that puts a PWM generator on these pins

It sounds like you would want a single PWM gen used in up/down mode
(this puts the PWM value on one pin for positive numbers and the other pin for negative numbers)

Note that the 7i76e_7i76x1pD.bit firmware has this configuration (last stepgen replaced with a PWMgen)
Last edit: 24 Jul 2019 22:38 by PCW.
The following user(s) said Thank You: Erikcnc

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

Time to create page: 0.111 seconds
Powered by Kunena Forum