Fadal 4020 upgrade

mycnc
Posts: 471
Joined: Thu May 10, 2018 2:42 pm

Re: Fadal 4020 upgrade

Post by mycnc » Thu Jan 10, 2019 11:26 pm

probe-wl-connection-001.png
Depends on the schematic you need a resistor connected accordingly.

mycnc
Posts: 471
Joined: Thu May 10, 2018 2:42 pm

Re: Fadal 4020 upgrade

Post by mycnc » Mon Jan 14, 2019 3:42 am

euroflo wrote:
Thu Jan 10, 2019 12:07 am
1... timers.... I want to adjust the timer for a longer period...

I have a lube system that need to turn on for 2 secs.... then off for 6 mins
Timers are implemented in the CNC control board to handle some more fast/frequent process without the Host computer.
If you need to run such a slow process, Software PLC procedure should work for you.

Something like this

Code: Select all

#define OUTPUT_OIL 15
main()
{  timer=0;
do{   timer++;
 if (timer==20) // 10 times/sec * 2
   {  portclr(OUTPUT_OIL);   };
 if (timer>3600) // 10 times/sec * 60 * 6
 {
  timer=0;
  portset(OUTPUT_OIL);
 };
}while(1);
exit(99);
};

euroflo
Posts: 23
Joined: Wed Dec 19, 2018 8:23 pm

Re: Fadal 4020 upgrade

Post by euroflo » Sat Jan 19, 2019 3:33 am

Hey mate
Timer is working great... how are you going with the speed code..?

Thanks
Justin

mycnc
Posts: 471
Joined: Thu May 10, 2018 2:42 pm

Re: Fadal 4020 upgrade

Post by mycnc » Sat Jan 19, 2019 4:49 am

questions:
1) What is maximum spindle speed? (maybe I missed it)
2) It's not clear about DAC output for different spindle gears

Normally spindle speed value is converted to DAC value range (12 bit 0...4095) to control 0-10V analogue output.

I think need to "cheat" and set RS485 communication in Spindle Tab,
then "Speed ratio (Modbus) set to "1"
mycnc-update-001-46.png
In this case, there will be raw spindle speed value in "eparam" variable in PLC.

After that, we can use a simple expression to handle spindle gear

Code: Select all

if (eparam<4999)
{ portset(OUTPUT_LOW_SPINDLE_SPEED);}	
else 
{ portclr(OUTPUT_LOW_SPINDLE_SPEED);};
It should be added to M03 and SPN procedures.

But also need to decide how to handle DAC output. Obviously, something with dac should be added into this if-else

euroflo
Posts: 23
Joined: Wed Dec 19, 2018 8:23 pm

Re: Fadal 4020 upgrade

Post by euroflo » Sat Jan 19, 2019 10:01 pm

Hey mate
Thanks for that, I will enter that in and see how we go.
Max speed is 10,000 RPM.
I think I know what you are getting at with the DAC for the 2 spindle gears....

My thinking is that we can leave the DAC the same for both, the way I am thinking is the lets say the DAC is output 10V (max)
in low range spindle speed, we get 5000 RPM, but if we have 10V in high range spindle speed we get 10,000 RPM.

Does that make sense..?? or am I thinking about it wrong..I should really get some way of measuring the RPM... will see about getting a meter to measure it...update just ordered a meter.

What do you think...?

Thanks
Justin

euroflo
Posts: 23
Joined: Wed Dec 19, 2018 8:23 pm

Re: Fadal 4020 upgrade

Post by euroflo » Tue Jan 29, 2019 11:49 pm

heres a vid of the machine in action



youtu.be/mQf-aXETADQ

euroflo
Posts: 23
Joined: Wed Dec 19, 2018 8:23 pm

Re: Fadal 4020 upgrade

Post by euroflo » Fri Feb 01, 2019 11:17 pm

Hey mate, just measured the RPM of the spindle....on screen requested 1000rpm actual is 758... what do I need to tweek to correct it..?

ok just did some testing... in low range with the speed set at 10,000rpm I get a reading of around 2500rpm....DAC =10V

but in high range at 10,000rpm i get around 9800rpm....DAC=10V

so unless my meter is faulty... lt looks like the low range is only good for up to 2500rpm... so will have to switch to high range for anything over that.

thanks
Justin

mycnc
Posts: 471
Joined: Thu May 10, 2018 2:42 pm

Re: Fadal 4020 upgrade

Post by mycnc » Mon Feb 04, 2019 11:33 pm

Sorry for the delay

Here is Spindle configuration Tab description
mycnc-spindle-cfg-002.png
Do you have "RS485/Modbus communication" selected?

I think It's better to set the checkbox to get "RAW" spindle speed value in the M03/SPN procedures.
As I remember I offered you to do so already.

In this case, it's easy to handle gears switching,
but need to adjust the DAC value inside the procedures. A few experiments will be needed.

I think it's good to edit SPN.plc procedure and test it by pressing Spindle speed increase/decrease.

SPN.plc source code is

Code: Select all

#include pins.h
main()
{
  //Change the Spindle State
  gvarset(7371,eparam);  timer=30;do{timer--;}while (timer>0);  //30ms delay

if (eparam<4999)
{ 
  portset(OUTPUT_LOW_SPINDLE_SPEED);
  speed=eparam;
  if (speed>4095){speed=4095;};
  dac01=speed;
}	
else 
{ 
  portclr(OUTPUT_LOW_SPINDLE_SPEED);
  speed=eparam/2;
  if (speed>4095){speed=4095;};
  dac01=speed;
};
exit(99);
};
Could you try this procedure?

Question: spindle gears can be switched on the fly? Or need to turn OFF before switching?


speed=eparam;
and
speed=eparam/2;
are very rough adjustment for DAC register.
There more accurate ratios will be needed for each gears range.

The PLCs do NOT accept floating point values, so mul/div style ratio will be needed
like-

speed=eparam*20/21; //a ratio is less than "1"
speed=eparam*21/20; //a ratio is more than "1"

Let me know if any question, waiting for test results.

euroflo
Posts: 23
Joined: Wed Dec 19, 2018 8:23 pm

Re: Fadal 4020 upgrade

Post by euroflo » Tue Feb 05, 2019 8:56 am

hey mate
I entered the code into SPN... but was saying syntax error line 19...

I sorted it out by closing the program down and restarting... that fixed it...

I have the RS ticked..... do i need to tick the 2 items in the " read register " section as per your pic..??

and spindle speed will have to be changed when the spindle is stopped

thanks
Justin

mycnc
Posts: 471
Joined: Thu May 10, 2018 2:42 pm

Re: Fadal 4020 upgrade

Post by mycnc » Tue Feb 05, 2019 1:18 pm

The answer in a video below


youtu.be/5owiJo4sQr8

Post Reply