
adccommunitymod (AutomationDirect) asked a question.
Created Date: June 16,2006
Created By: znelson
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I'm working on a windows application that communicates with plc hardware (an 05 right now) using a modbus driver. I 've tried several drivers from different manufacturers but I'm getting the same result. I have an input on X0 (the led is lit confirming this). Using the modbus_conversion xls, I see that X0 maps to 12049. When I try to read the state of the input programatically I get "illegal address " errors. I'm using ReadDiscreteInput() and ReadInputRegister() but get the same result. If anyone could shed some light, I'd greatly appreciate it!
Created Date: June 28,2006
Created by: yura
I did it thousands times even from DOS programs. There are few very simple rules:
1. V-mem address is the number of HOLDING modbus register (func 3), just convert it to decimal number.
2. Use read/write functions for HOLDING registers (func 3, 6 or 16(0x10))
3. For DL05:
X0-... - V40400(16640 dec)
Y0-... - V40500(16704 dec)
C0-... - V40600(16768 dec)
4. I guess you should use ReadHoldingRegister() or so...
http://forum1.automationdirect.com/board/eek.gif
Best regards...
Created Date: July 26,2006
Created by: znelson32
I 've gotten the 05 communication to work. I can query the status of the discrete inputs starting with 2048. But I am having problems doing the same thing with a 350 CPU. According to the user manuals for both systems, the inputs start at 2048 and go up from there. But when I query the 350, I get a modbus timeout (which leads me to believe I'm asking for something out of range perhaps). I'm connecting to both CPU's with the same connection settings as I use with DirectSoft: 9600 baud, 1 stop bit, odd parity, 8 data bits. I can talk to the 350 with DS but nothing else, not even the modscan utility.
Please advise, I'm running out of options http://forum1.automationdirect.com/board/smile.gif
Created Date: July 27,2006
Created by: Tech Guy
Are you using the same cable for both?
The top port cannot communicate with MODBUS.
You can connect with DirectSoft because DirectSoft uses DirectNet or K-Sequence fro a serial connection.
The 05 has 2 ports that use the same connector (RJ12 or RJ-25) so the cable can be used in either port.
From 350 User Manual Page 3-5
The DL350 has a total of two communications ports. The top port is a 6 pin modular
that provides a built"in RS232 communication port. It can be used for easy
connection of the handheld programmer, PC, or used for a DirectNET slave. The
bottom port is a 25"pin RS232C/RS422 port. It will interface with DirectSOFT, and
operator interfaces, provides built"in Remote I/O, DirectNET and MODBUS RTU
Master/Slave connections.
Created Date: July 27,2006
Created by: znelson32
Thank you! I was thinking about this last night and found the same port issue this morning in the user manual. Makes complete sense. Thanks again!
Created Date: August 04,2006
Created by: znelson32
I'm up against a wall again. Tech support from AD tells me I need a D3-DSCBL-2 cable to connect from a serial port to port 2 of a 350 cpu. I get the cable and have the same problem. The Rx light flashes, but Tx does not.
Using DS32 and the same cable, I can talk to the CPU.
Using the same connection settings, cable, but a commercial modbus driver, I cannot get a response from the 350.
Now here's what really throws me off. Using the same modbus driver, connection settings, (different cable of course), I can communicate successfully with an 05 cpu. I ask for the state of X0, and it replies perfectly. I just can't get anything out of the 350.
-----------------
On a side note: On the 05 (since I can communicate with it), I can check the state of the inputs (ie. X0), but I cannot find a way to set the state of an output (ie. Y0). I'm starting to think this isn't even possible (perhaps only the cpu can set output states?). I 've been asking tech support from both AD and my driver vendor since January and they 've never said it can't be done, I just can't figure it out. I 've set the proper coil to 1/true but the output relay doesn't close.
Maybe you can only directly-affect the state of an output on a Field I/O setup?
Thanks in advance for all the help guys, you have no idea how much I appreciate it!
Created Date: August 04,2006
Created by: Tech Guy
I would assume that you have checked the settings of port 2 on the 350 to make sure that they match the driver? All of the PLC's are not exactly the same for the port 2 baud rate.
As far as setting an output, it should work...IF the output coil is not being used in the program. Since communications takes place at the start of scan, any change made via communications will be over-written by the ladder logic if the coil or register is used as an output in the ladder program.
Created Date: August 04,2006
Created by: znelson32
on the 350: I matched the comm settings used by DS32, 9600 baud, 8/1 bits, odd parity. I figured if the settings work for DS32 they should work for my little utility. Is that a safe assumption or could comm settings differ because I'm using modbus and not directnet? And if that's the case, then I'm not sure how to check port 2's favored settings, perhaps DS32 can tell me?
on the 05: That makes sense. The output is definately used by the program so perhaps it's being overwritten. I tried setting Y0 in all 3 modes though (run, term, stop) but none worked. If the plc is in term and not running a program, can I still set Y0? If I can, then the program shouldn't overwrite it, since it's not running. Should I be setting the Y0 using WriteCoil() or WriteHoldingRegister()? I 've tried both in the past.
Thanks again!
Created Date: August 04,2006
Created by: Tech Guy
Go to the PLC menu -> Setup -> Setup Sec. Com Port. Use the same settings found here in you Driver.
As long as it is used in the program it will not turn on. The PLC must be in Run mode in order for an Output to turn on. If you want to affect the Output, use an intermediary coil that you will place in the ladder logic to turn the output on.
Created Date: August 04,2006
Created by: znelson32
Sounds good. I thought about doing that, using an intermediary address and having a rung that watches it and then controls the output accordingly. Is there no way to directly control the output? What if I completely clear the program and have nothing in there? Would the cpu use the value I'm sending it for the output or just do nothing (in other words, do I need the intermediary)?
Created Date: August 04,2006
Created by: Tech Guy
If the output is not used in the program, then it can be controlled directly via communications.
You have to have at least an END statement, so the PLC can be placed in RUN mode.