Author Topic: Writemodbus  (Read 12066 times)

Derek

  • Newbie
  • Posts: 7
  • Coffee! :)
    • View Profile
Writemodbus
« on: February 14, 2012, 05:03:41 PM »
Greetings,
I have an F2424 that I'm setting up to control 5 VFDs via rs485.  There are 3 Powerflex 400 drives and 2 Powerflex 4 drives.  I can read the drives status easily using READMODBUS. However, when I use WRITEMODBUS or WRITEMB2, STATUS(2) returns 0.  This is only the case with the PF400, the PF4 works fine.  


I set up a serial monitor, to read what the plc was sending, then using the terminal, sent the commands manually to see what the response from the drive was, as follows:

PLC command:  WRITEMODBUS 13, 102, 8192, 13586

"start command"  66 10 20 00 00 01 02 35 12 9E FD
 
response from PF400:  66 90 01 3C 1F

    Function Code 16 sent  Exception Code 1 returned

So I created the same command and sent manually from my pc only using Function Code 06 and repeated the experiment:

"start command" 66 06 20 00 35 12 1d 40

response from PF400:  66 06 20 00 35 12 1d 40

In the end I was able to manually start and stop the PF400
using Function Code 06, but always got Exception Code 1 when using Function Code 16. So my inital conclusion is that the PF400 drives only accept write function 06.

Question:    
Will TBasic WRITEMODBUS and WRITEMB2 only use Function code 16?  Is there an easy way to send Function Code 06 instead of 16?



Regards,

Derek


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Writemodbus
« Reply #1 on: February 15, 2012, 08:20:40 AM »
If your PLC firmware version is r74 or later it supports using the Modbus function 06 by running the following statement:

    SETSYSTEM 6,6

After running the above statement WRITEMODBUS will be using function 06 to write to the slave. WRITEMB2 will continue to use function 16 (of course).

If you need to send Function 04 (when using ReadModbus or ReadMB2) then run SETSYSTEM 4,4.

To use default Modbus function 03 and 16, run
 
   SETSYSTEM 6, n where n is neither 4 nor 6.

You can also use TBASIC to generate other Modbus functions. We have examples in the FAQ thread of this forum:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=298
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Derek

  • Newbie
  • Posts: 7
  • Coffee! :)
    • View Profile
Re:Writemodbus
« Reply #2 on: February 15, 2012, 09:04:21 AM »
SETSYSTEM 6,6    Worked like a charm!   Thank you

dixinke

  • Newbie
  • Posts: 1
  • I'm a llama!
    • View Profile
Re:Writemodbus
« Reply #3 on: February 26, 2012, 05:37:54 AM »
66 90 01 3C 1F
16#90=16#80+16#10
maybe not support this data area or not support this function mode 16#10