. .
  1. #1
    Hello All

    I have a Altivar 320vfd ( B&R P74) and I wanted to control it via Modbus in UCCNC, I use a USB-RS485 converter from my desktop PC and to the VFD

    it look as every thing is "Green " in the Modbus-plug in, but it wil not start up ??? anyone who have a Idea what I am doing wrong ????

    Click image for larger version. 

Name:	Altivar320modbus.jpg 
Views:	141 
Size:	55.0 KB 
ID:	30070

    the last number in the "Green" line is changing number all the time Name:  Altivar320modbus-number.jpg
Views: 548
Size:  5.5 KB

    hope for help :-)

    Bent

  2. #2
    Hi Bent,

    It looks like you are only reading registers, not writing (sending) any commands to the VFD register which controls start and stop and the spindle speed. I include pictures of my Modbus Master screens, yours should look similar regarding start / stop and spindle rpm command. Of course, register numbers don't match, so you can't just copy mine, but as you see, I am writing to a register for on/off and rpm. That process in my case can be done in one commend, or two if I wanted to, but I do it in one.

    Click image for larger version. 

Name:	Modbus Master 1.JPG 
Views:	174 
Size:	73.5 KB 
ID:	30072

    Click image for larger version. 

Name:	Modbus Master 2.JPG 
Views:	160 
Size:	72.8 KB 
ID:	30073

    Click image for larger version. 

Name:	Modbus Master 3.JPG 
Views:	171 
Size:	52.8 KB 
ID:	30074

    Click image for larger version. 

Name:	Modbus Master 4.JPG 
Views:	159 
Size:	48.9 KB 
ID:	30075

  3. #3
    Hi A_Camera

    I wil try to change to "write multiplyregister" and see if anything is happend then....

    in my "Variables table" I only have "0" ???

    I will be back :-)

    Ben

  4. #4
    You must also write a macro which actually controls everything.

    Code:
    // ----------------------------------------------------------------------------------------------------
    //
    // 	M20304 Seting the spindle speed, runing CW/CCW and reading some VFD and spindle parameters.
    //	This is a Modbus interface macro and is running in a macro loop.
    //
    // When this macro is called it will check the Set Spindle Speed and the Spindle Speed Override DRO
    // and will calculate the matching frequency. This is set in Modbus register which is sent to the VFD.
    //
    // After this step it will check the state of RUN CW/CCW LEDs and will set the necessary VFD commands.
    //
    // Last it will read some VFD parameters and display in UCCNC.
    //
    // ----------------------------------------------------------------------------------------------------
    //
    //	Constants
    //
    ushort RunSpindleCW 		= 129;    	// Rexroth EFC5610 RUN CW command
    ushort RunSpindleCCW 		= 133;    	// Rexroth EFC5610 RUN CCW command
    ushort StopSpindleRun 		= 136;   	// Rexroth EFC5610 STOP command
    
    ushort SSetDRO 			= 869;
    ushort SactDRO 			= 870; 
    ushort SSOverriddenDRO		= 2451; 
    ushort MaxSpindleSpeedDRO	= 178;
    double MaximumRPM 		= 24000;
    
    int OutputVoltage		= 20010;	// VFD and spindle monitoring parameter field numbers
    int OutputCurrent		= 20011;
    int OutputPower			= 20012;
    int DCBusVoltage		= 20013;
    int OutputTorque		= 20014;
    int PowerModuleTemp		= 20015;
    int ActualSpeed			= 20016;
    int SpindleTemp			= 20017;
    int SpeedArrival		= 800;
    
    ushort OutputVoltageDRO		= 20010;
    ushort OutputCurrentDRO		= 20011;
    ushort OutputPowerDRO		= 20012;
    ushort DCBusVoltageDRO		= 20013;
    ushort OutputTorqueDRO		= 20014;
    ushort PowerModuleTempDRO	= 20015;
    ushort ActualSpeedDRO		= 20016;
    ushort SpindleTempDRO		= 20017;
    ushort SpeedArrivalLED		= 800;
    
    ushort SpindleRunReg		= 0;		// Dispayed UCCNC Modbus register list
    ushort VFDFrequencyReg	 	= 1;		
    ushort ActualSpeedReg		= 11;
    ushort OutputVoltageReg		= 20;
    ushort OutputCurrentReg		= 10;
    ushort OutputPowerReg		= 22;
    ushort DCBusVoltageReg		= 23;
    ushort OutputTorqueReg		= 24;
    ushort PowerModuleTempReg 	= 30;
    ushort SpeedArrivalReg		= 40;
    
    
    //
    //	Variables
    //
    string SspeedOverride;
    int IndexOfPercentSign;
    string SSpeedOverride;
    
    double Current;
    double Power_kW;
    double Torque;
    double SSpeedHz;
    
    //
    //	Program starts here
    //
    //-------------- Set spindle speed value firtst ---------------------------------------------------------------
    //
    //
    	MaximumRPM = AS3.Getfielddouble(MaxSpindleSpeedDRO);
    	SSpeedHz = ( AS3.Getfielddouble(SSOverriddenDRO));
    	if (SSpeedHz > MaximumRPM)
    	{
    		SSpeedHz = MaximumRPM;	// Force maximum RPM to prevent exception
    	}
    //
    // Calculate the matching RPM frequency and send the value to Modbus register.
    //
    	exec.SetModbusregister(VFDFrequencyReg, (ushort) Convert.ToUInt16(SSpeedHz / 0.6));  
    //
    //-------------- Send start/stop command for the spindle --------------------------------------------------------
    //
    //	Check the CW and CCW LEDs and convert the state to spindle control commands.
    //	The command is set in the Modbus register which is sent to VFD using the UCCNC Modbus internal handler.
    //
    //	Check CW and CCW LEDs, start or stop the spindle based on LED states.
    //	After exiting this macro the Modbus register is set up for CW, CCW or Stop
    //
    	if ( AS3.GetLED(50) == true )  // If the RUN CW LED is active
    	{
      		exec.SetModbusregister(SpindleRunReg, RunSpindleCW);	//Turn spindle on in CW rotation if LED is on
    	}
    	else
    
    	if ( AS3.GetLED(51) == true )  // If the RUN CCW LED is active
    	{
        		exec.SetModbusregister(SpindleRunReg, RunSpindleCCW);	//Turn spindle on in CCW rotation if LED is on
    	}
    	else // CW and CCW LEDs are off, send turn spindle OFF commnad
    	{
        		exec.SetModbusregister(SpindleRunReg, StopSpindleRun); 	// Send Rexroth EFC5610 STOP command to VFD
    	}
    
    // ----------------------------------------------------------------------------------------------------
    //
    // Reading the VFD parameters via Modbus
    //
    // ----------------------------------------------------------------------------------------------------
    //
    //
    // Get the parameters from the VFD and output to display
    // 
    
    	exec.GetModbusregister(OutputVoltageReg, out OutputVoltageDRO);
    	AS3.Setfield(OutputVoltageDRO, OutputVoltage);
    
    	exec.GetModbusregister(OutputCurrentReg, out OutputCurrentDRO);
    	Current = Convert.ToDouble(OutputCurrentDRO * 0.01);
    	AS3.Setfield(Current, OutputCurrent);
    
    	exec.GetModbusregister(OutputPowerReg, out OutputPowerDRO);
    	Power_kW = Convert.ToDouble(OutputPowerDRO * 0.1);
    	AS3.Setfield(Power_kW, OutputPower);
    
    	exec.GetModbusregister(DCBusVoltageReg, out DCBusVoltageDRO);
    	AS3.Setfield(DCBusVoltageDRO, DCBusVoltage);
    
    	exec.GetModbusregister(OutputTorqueReg, out OutputTorqueDRO);
    	Torque = Convert.ToDouble(OutputTorqueDRO) * 0.1;
    	AS3.Setfield(Torque, OutputTorque);
    
    	exec.GetModbusregister(PowerModuleTempReg, out PowerModuleTempDRO);
    	AS3.Setfield(PowerModuleTempDRO, PowerModuleTemp);
    	exec.GetModbusregister(ActualSpeedReg, out ActualSpeedDRO);
    	AS3.Setfield(ActualSpeedDRO, ActualSpeed);
    	AS3.Setfield(ActualSpeedDRO, SactDRO);
    
    	exec.GetModbusregister(PowerModuleTempReg, out SpindleTempDRO);
    	AS3.Setfield(SpindleTempDRO, SpindleTemp);				// Temorarily set the power module temp here
    
    	exec.GetModbusregister(SpeedArrivalReg, out SpeedArrivalLED);
    	
    	if (SpeedArrivalLED == 1)
    	{
    		AS3.SetLED(true, SpeedArrival);
    	}	
    	else
    	{
    		AS3.SetLED(false, SpeedArrival);
    	
    	}
    
    	
    	if (AS3.Getbuttonstate(144) == true)	//Check if the Reset button is active.
    	{
    		exec.Clroutpin(3, 17);		// Turn off the fan
    		AS3.SetLED(false, 801);		// Turn off the LED
    	}	
    
    
    //
    //------------------------------------------------------------------------------------------------------
    //
    //	End of program
    This is my code, but as I explained in the mail to you, you must change the code to match your VFD. This code is running in a macro loop.

    Click image for larger version. 

Name:	Macro loop.JPG 
Views:	139 
Size:	48.1 KB 
ID:	30076

    The macro loop monitors the buttons and places (in my case) 129 (CW), 133 (CCW) or 136 (STOP) commands in Modbus registers, together with the spindle rpm. My recommendation is that you keep it simple and initially you only try starting and stopping the spindle. Take the next step when you understand how everything is working together.

    Note that you CAN'T simply copy my code and use it as it is, you must change it to match your VFD. This code works ONLY with my Bosch Rexroth EFC 5610. My code does so much more, and is too complicated to start with unless you are an experienced programmer.

  5. #5
    Quote Originally Posted by eskolin View Post
    Hi A_Camera

    I wil try to change to "write multiplyregister" and see if anything is happend then....

    in my "Variables table" I only have "0" ???

    I will be back :-)

    Ben
    Hi Ben,
    How is it going? Did you manage to use Modbus?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Modbus monitoring and control using UCCNC
    By A_Camera in forum CNCdrive (UC100, UC300ETH)
    Replies: 2
    Last Post: 08-04-2021, 08:05 PM
  2. Master degree title
    By masinecc in forum General Discussion
    Replies: 1
    Last Post: 19-04-2016, 09:05 PM
  3. routing wax mould master?
    By mark84 in forum General Discussion
    Replies: 1
    Last Post: 12-04-2016, 12:38 PM
  4. Anybody know about Modbus addressing?
    By m_c in forum General Electronics
    Replies: 4
    Last Post: 15-11-2013, 02:18 PM
  5. NEW MEMBER: Old Colchester Master
    By Nellster in forum New Member Introductions
    Replies: 6
    Last Post: 31-07-2010, 06:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •