You are on page 1of 14

Objective:

Communication between M340 and ATV312 over Modbus using WRITE_VAR and READ_VAR.

Hardware:

(1) M340 : processor( BMX P34 20102)


(2) Altivar 312
(3) VW3A8306R30 (Cable for Modbus serial link equipped with 2 RJ45 connectors).

Software:

Unity Pro

Configuration on Drive:

(1)Do the Factory Settings.


(2)LAC[Access Level] = [Level3](L3)in
[Level3](L3) [COMMAND](CtL-)menu
(3)FR1= [Modbus]Mdb) in [COMMAND](CtL
[COMMAND](CtL-)menu
(4) Add[Modbus Address]= 1 in [COMMUNICATION](COM-)menu
[COMMUNICATION](COM
(5)tbr[Modbus baud rate]= [19.2 Kbps] in [COMMUNICATION](COM
[COMMUNICATION](COM-)menu
(6) tFO[Modbus format]= [8-E-1]
1] in [COMMUNICATION](COM-)menu
[COMMUNICATION](COM

Configuration on PLC:

(1)Launch the Unity Pro Software and click on NEW.


(2) Configure with power supply module and M340, BMX series processor (Example: BMXP3420102).

(3) Click on OK.


(4) Double click on “Configuration”.

(5)Double click on serial port and Configure the Serial Port (RS485,RJ45 Port) of BMXP3420102,
configure it a Master and Slave ID=1 for ATV312, Baud rate: 19200 Kpbs, Parity: even, Modbus
(RTU):8-bit, Stop Bit:1
(6) To run the write var or read var, it is necessary to do following setting:
Tools=>Project setiing=>variables:

(7)Create new section:


(8)Select Language FBD.

(9)Click on OK.
(10) Open program section and add WRITE_VAR and READ_VAR function block.

=>The ADDM function is used to convert a character string into an address that can be used directly by
the following communication functions: READ_VAR and WRITE_VAR.

For addressing a device using Modbus protocol, parameter IN takes the form: ‘r.m.c.e.MBS’
Where:
r: rack number (rack)
m: module position
c: channel number (channel) of Modbus port (0)
e: Modbus slave number (equipment) (range 1 to 247)
MBS: for addressing a Modbus server
So,IN of ADDM = ‘0.0.0.1’

=>EN-write_on = to on the write_var function block


=>OBJ – Type of objects to write for Modicon M340 PLCs:
’%M’: internal bits,
’%MW’: internal words
=> NUM-First_Object - Index of the first object to be written in the destination device.
The Logic address of control word (CMD)for ATV312 is 8501.it is the first object.
=>NB- Object_Number - Number of objects to write – 2 .
nd
Means- First number of object is 8501 and 2 number of object is 8502 and it is the logic address of
Frequency reference(LFr).
=>EMIS- Data_to_Write - Word table containing the value of the objects to be written.
=>GEST- Management_Param- Management parameters are grouped together in the form of an array of
four integers. The values contained in this array can be used to manage communication functions.
It could be denoted as %MW10:4 (Data type = ARRAY [1..4] of INT). guest will occupy four words
starting from register address %MW10 upto %MW13.
=>Similar way, READ_VAR can be configured. 9001 and 9002 are the logic address of ACC(Acceleration
ramp) and dEC(Deceleration ramp) and it is possible to read the ACC & dEC value on RECP(i.e.
read).where RECP=> Word table containing the value of the objects read.

(11) Then Analyze the Project.

(12) And Rebuild All Project.


(13) Transfer Project to PLC.

(14)Click on “Tansfer Poject to PLC”.


(15) Click on Transfer:

(16) Select WRITE and READ VAR functional block.


(17) Right click on selected area.

(18)Click on “Initialize New Animation table” to Lauch the Animation Table.


(19) Write the 400 on wr2 (i.e. 8502 – frequenece reference ) for LFr - frequency refernce 40 Hz.

(20) Write 6,7 and 15 one by one on wr1( i.e. 8501- command word) for CMD-command word to run the
ATV312 Drive.
(21) First write “6” on wr1.

(22) Secondly, Write “7”on wr1.


(23)Thirdly, Write “15” on wr1.

And then ATV312 drive will run & at 40 Hz frequency.

And see below,thers is a value100 on read[1] and read[2].it is the value of ACC and dEC ramp time which
is 10 second.So,by this way,we can read ACC and dEC value.

You might also like