Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: joelaw on February 23, 2016, 11:57:19 AM

Title: Mach 3 PWM signal inverted?
Post by: joelaw on February 23, 2016, 11:57:19 AM
I need help with the PWM signal from Mach3.  I am hooking up a Super PID and the PWM signal is inverted.  When I send a M3 S5000 I get 25,000 rpm and when I send a M3 S25000 I get 5,000 rpm.  I have tried changing the Pin 14 output from active High to active Low but the signal does not invert.

Am I doing something wrong or do I have to build an inverter to go between the PWM and the PID?

Thanks,

Joe Lawrence
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 08:48:49 AM
Nobody else having this problem?

The active check box doesn't change the PWM direction.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: stirling on February 25, 2016, 09:29:46 AM
please post your xml file (usually C:\Mach3\Mach3Mill.xml unless you're using a different profile) copy it, rename it to joelaw.xml and use reply/additional options (not quick reply).
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 10:07:33 AM
Joelaw1 is my mach3 file and joelaw2 is my router xml.
Title: Re: Mach 3 PWM signal inverted?
Post by: stirling on February 25, 2016, 10:45:10 AM
Joelaw1 is my mach3 file and joelaw2 is my router xml.

Not sure what you're meaning there - which is the xml you're using?

Anyway - I tried your Joelaw1.xml and it works just fine here. I get positive going correct duty cycles and when I tick step low I get negative going duty cycles.
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 11:11:11 AM
I am sorry, you asked for the Mach3.xml so the Joelaw1.xml file is the Mach3.xml.  The Joelaw2.xml is the setup that I am using.  I looked at the xml file and the Pin 14 output is set to 0 so I changed it in Mach3, closed and looked again and now it is a 1.  This still doesn't change the PWM from High going low to Low going high.

When I send a S30000 I get a low small pulse and when I send a S5000 I get a high small pulse going low.  This is reversed from what it should be and changing the 0 to 1 doesn't change the PWM at all.  I think it should change the pulse from high or +5v to low or 0v but no change?

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 25, 2016, 12:04:57 PM
Hey Joe,
  Not sure if this matters, but the manual isn't really clear if this will work with the PWM signal.
Might try it though. In the Config ... Spindle Pulleys dialog.

Kind regards,
Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 25, 2016, 12:12:23 PM
Also, are you running the SS ? or PP ?
Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: stirling on February 25, 2016, 12:15:41 PM
You have a max pulley of 30000. Let's say you're set active HIGH.

If you command S30000 then you're asking for 100% duty cycle. You can't have a 100% duty cycle PWM - it would be permanently high and therefore wouldn't be PWM anymore. What you get is what you see in scrnsht1.jpg. i.e. you're getting as near as 100% i.e. 99.3996% HIGH.

When you command S5000 you're commanding 30000/5000 i.e. 1/6th speed. 1/6th is 16.666%. See attached scrnsht2.jpg. Bang on.

Flip it to active low and you get the exact opposite i.e. 99.3996% LOW and 16.666% LOW. Again Bang on.
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 12:27:25 PM
Overloaded,  I don't know what SS or PP is refering to?

Stirling, are you saying that the 30000 setting is to high.  I know that I don't really get 100% low or high PWM but I am seeing a 5v going low when I need a 0v going high.  The check box for Pin 14 does not change things.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 25, 2016, 12:38:19 PM
Sorry Joe.
SmoothStepper (in your XML) or Printer Port.
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 12:57:04 PM
I use an ethernet SmoothStepper.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 25, 2016, 02:55:00 PM
Most likely, but do you have the spindle configured there as well ?
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 03:14:07 PM
I don't have a spindle on this machine.  I have a Blacktoe 2' X 4' CNC router to build most things.  I use the Shapeoko3 for laser only.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: BR549 on February 25, 2016, 04:37:23 PM
Good Luck Russ ,   ;)
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 25, 2016, 06:29:04 PM
I don't have a spindle on this machine. 
Joe

So then, what is the SuperPID Spindle controller for ? to run the laser ?
I'm (more) confused.  ::)
Might should back up a bit and provide a bit more info.
I did see some similar issues posted on the Warp9 forum, you might look there too.

Russ

TP, please pass that bucket o' corn.  :)
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 25, 2016, 09:15:24 PM
I am using a Blacktoe router, Mach3 software, a Smoothstepper ethernet converter, A14A breakout board, Super PID controlling a Porter Cable router speed.  Everything works except the PWM pulse to the PID is inverted meaning that I get a high PWM going low for slow speed and that is backward from what the PID needs.  My whole problem is that I cannot find a way in Mach3 to change the PWM pulse to be low going high to get slow speed.  It wants to get S25000 to achieve a speed of 5000 rpm which is wrong and a S5000 to get a 25000 rpm.

This used to work fine but some setting is wrong and no one can tell me which setting.  The Output tab in Mach3 is set to Output #2 Pin 14 with active checked or Xed and nothing changes.  I could build a inverter circuit but that is not the correct way to get the right PWM out of Mach3.

Why doesn't changing the active high to low or back change the PWM pulse to low going high?  When this is changed it shows up in the Mach3.html file correctly but no change in PWM.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 26, 2016, 12:30:44 AM
Most likely, but do you have the spindle configured there as well ?

I'll rephrase that as I think I might have confused us. ::)
Have you configured the PWM settings in the Smoothstepper accordingly?
You most likely did, just confirming.

Also, the only other thing I see that appears contrary to the manual is the Spindle direction pin should be 0.
May be a conflict with your pin1 selection for the CW and CCW relay selection.
Might ... or might not matter. Worth a try though.

Regards,
Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 26, 2016, 08:09:08 AM
My Smoothstepper  config is set correctly.  The output is set correctly and changing the check box to 'X' does not change anything.  That is the problem why?

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 26, 2016, 08:35:47 AM

This used to work fine ................................

You might reconfigure to another/different output pin. Looks like 17 is available.
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 26, 2016, 09:55:33 AM
I will try that before re-installing Mach3.  Pin 14 to Pin 17 should not make a difference but it is worth a try.  I really don't want to re-install Mach3 and do all of the setups again.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 26, 2016, 11:11:52 AM
I moved pin 14 to Pin 17, reconfigured with the same result M3 S25000 runs 5000 rpm. I changed the "Active Low" check box to checked and it is the same??

Joe

Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 26, 2016, 12:47:28 PM
From page 8 .......

"Note: Even though the Mach3 Mill Manual specifies that you do not need to define a direction pin for PWM
Control, I found that it needed to be defined to make the Mach3 / SmoothStepper combination happy. I
defined it as Pin 1 Port 2 but it is not connected to anything. I don’t understand why this is necessary, but it
works for me."

of this ....

http://www.machsupport.com/forum/index.php?action=dlattach;topic=15457.0;attach=21882

Endeavor to persevere.
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 26, 2016, 04:31:58 PM
Overloaded:

I finally got it to work.......

I found an old xml file of my setup from months ago and copied it to the Mach3 folder.  When it runs everything works as it should.  I go back to the xml I was using and it is wrong.

I tried comparing the files but the file compare program (i downloaded 6 different ones) could not parse the file into single lines.  All code was in one long line and I could not tell where the differences were.  Will keep working on that later.

I then made screen shots of all of my setups of each file running in Mach3 and saw some differences so I went back to the (not working) file and changed each setting one at a time trying the spindle each time but nothing changed.  None of the differences changed the PWM direction.   All settings in both files are the same using Mach3 setup tabs screen shots and I find no difference but one works and one doesn't.  Go figure.....

I am just going to run the old file and delete the one I was using and forget about it.  The only one who might possibly know is Art and I know he is too busy for this.

Need to find a file compare program that will allow a carriage return at end of each line so it is readable and compare every single line of the settings.

I want to thank everybody that has tried to help me on this for your interest and time.  Maybe someday I will find out what is going on and will post the fix in case it happens to someone else.

Thanks again.

Joe
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 26, 2016, 04:56:41 PM
Good news Joe, perseverance pays off.

Do you mind to post the working XML ? I'm curious.

Thanks,
Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: joelaw on February 26, 2016, 05:23:06 PM
Just to let you know I found the problem :) :) :) :) :) :) :) :) :)

In the motor outputs tab there is a setting for "Step Low Active" and it was checked.  Changing it to 'X' fixed all my problems.  I guess nobody thought the motor settings had any effect on the PWM BUT IT DOES!

This nightmare is over after almost a week.

Joe Lawrence
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 26, 2016, 05:38:15 PM
SH*T,  ;D
 I assumed that is what you have been flipping all along .... Ian probably did too. He demonstrated it early on in reply #8 !
That's what I get for assuming.

Glad you got er'.

Good work Joe. :)

Regards,
Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: stirling on February 27, 2016, 05:15:20 AM
 :-X

http://www.youtube.com/v/VmW-ScmGRMA?hl=en_US&version=3
Title: Re: Mach 3 PWM signal inverted?
Post by: Tweakie.CNC on February 27, 2016, 06:55:04 AM
 ;D

Tweakie.
Title: Re: Mach 3 PWM signal inverted?
Post by: Overloaded on February 27, 2016, 07:18:15 AM
;D

Tweakie.

Ditto  :)
Good one Ian, I needed that this morning.

Russ
Title: Re: Mach 3 PWM signal inverted?
Post by: BR549 on February 27, 2016, 11:57:07 AM
Somedays is is best just to eat  popcorn and watch the movie.   :D

(;-) TP