Closed programlayan closed 4 years ago
I think the only way this will work with your CPU is if we add support for 3E frames. (Or another type, but 3E looks like it would support the most additional CPU types). I would be willing to do a bit of work on this but I don't have a test CPU other than an FX3U so I think the only way we could make this work is if someone else had some time and a test CPU to help get it working. I will see what I can do in the next week or two.
Hello, Thank you for your response, I can test, also if you want to test too, I can send a remote connection for testing purposes too. Thank you.
OK I pushed a new version to the repository (but not to npm), and it seems to send the right packet in both ASCII and binary to read device memory. To activate the new code add connection options frame: '3E' and it would help if you added debug: true as well.
Use care in testing on a real PLC. I've tried to be careful but I have no way of testing these frames on a real CPU.
Hello, Thank you, I will try it, but Covid-19 reasons I am out of office since 6 April.
OK, let me know. COVID-19 is the reason I had time to work on this. Hopefully by 6 April things are better everywhere.
Hello I tried new code: .. var variables = { TEST1: 'D100,1'}; .. conn.initiateConnection({port: 1280, host: '192.168.3.249', ascii: false}, connected);
Tried read value only.
---- result ----
[60450,48886812] Initiate Called - Connecting to PLC with address and parameters:
[60450,52312441] { port: 1280, host: '192.168.3.249', ascii: false }
[60450,53998936] Connection cleanup is happening
[60450,54141153 192.168.3.249] Clearing read PacketTimeouts
[60450,54258652 192.168.3.249] Clearing write PacketTimeouts
[60450,54976305 192.168.3.249]
D100 value is 21 (word)
I added image SLMP connection https://ibb.co/L1wYTRm
Ahh sorry, my mistake, I just installed library again from github.
same scenario and the output is:
[64460,616653189] Initiate Called - Connecting to PLC with address and parameters:
[64460,619149926] { port: 1280, host: '192.168.3.249', ascii: false }
[64460,621206835] Connection cleanup is happening
[64460,621375635 192.168.3.249] Clearing read PacketTimeouts
[64460,621496513 192.168.3.249] Clearing write PacketTimeouts
[64460,622201112 192.168.3.249]
Try adding frame: '3E' and debug: true in the same object where you specify the port and IP address. It is still sending the same 1E frames as before without the frame option.
Hello, I added SLMP by PLC, set its Protocol TCP and port 1281. There is no debug option here. (Please copy and paste the URL: https://ibb.co/L1wYTRm ) On the node side, I assigned debuglevel 99 and frame 3E. The current value of D100 is 26.
-- output --
[82843,780524530] Initiate Called - Connecting to PLC with address and parameters:
[82843,782854481] { port: 1281, host: '192.168.3.249', ascii: false }
[82843,784485046] Connection cleanup is happening
[82843,784603726 192.168.3.249] Clearing read PacketTimeouts
[82843,784740048 192.168.3.249] Clearing write PacketTimeouts
[82843,785440584 192.168.3.249]
Ok, please try the latest commit.
Also, if that doesn't work, or if you want more features even if it does, check out this fork at https://github.com/Steve-Mcl/mcprotocol - you should be able to test the file in that version, with frame: '3E' and it should work. We're discussing merging those changes into this project.
Hello,
Thank you for your effort.
Results are the same as previous test.
I will try other package.
Thank you.
--output--
[1045,547033914] Initiate Called - Connecting to PLC with address and parameters:
[1045,550602868] { port: 1281, host: '192.168.3.249', ascii: false }
[1045,552690940] Connection cleanup is happening
[1045,552868583 192.168.3.249] Clearing read PacketTimeouts
[1045,553022278 192.168.3.249] Clearing write PacketTimeouts
[1045,553867865 192.168.3.249]
I think you loaded the wrong file when updating as I can tell you're back to 1E frames there.
Hello I tried Steve-Mcl fork, it is working. Thank you.
Does it work with ethernet comm based fx5u and Q/L or R series plc?
Is Cc-Link supported?
Hello, I tried to connect FX-5U with mcprotocol. (With default ethernet configuration) Connected but timeout occured. (Port 1280 used) When I try to add SLMP and port 1281 connection refused. What can I do for connection? thank you.
--default configuration full output -- osboxes@osboxes:~/Desktop/plc$ node index.js [13654,472511518] Initiate Called - Connecting to PLC with address and parameters: [13654,474872590] { port: 1280, host: '192.168.11.253', ascii: false } [13654,476336891] Connection cleanup is happening [13654,476448689 192.168.11.253] Clearing read PacketTimeouts [13654,476540692 192.168.11.253] Clearing write PacketTimeouts [13654,477061769 192.168.11.253]
[13654,477157964 192.168.11.253] Attempting to connect to host...
[13654,479260801 192.168.11.253] TCP Connection Established to 192.168.11.253 on port 1280
[13654,479759896] Translation OK
[13654,479902438 192.168.11.253] Reading All Items (readAllItems was called)
[13654,480222241 192.168.11.253] Adding or Removing { arg: [ 'TEST1' ], action: 'add' }
[13654,480343069 192.168.11.253] Adding TEST1
[13654,481492403 192.168.11.253] Clearing read PacketTimeouts
[13654,481623624 192.168.11.253] Calling SRP from RAI
[13654,481789472 192.168.11.253] SendReadPacket called
[13654,481951201] We're Binary
[13654,482263745] The Returned MC Buffer is:
[13654,482325446] <Buffer 01 ff 0a 00 00 00 00 00 20 4d 01 00>
[13654,482583582] The returned buffer length is 12
[13654,482715223] The final send buffer is:
[13654,482768884] <Buffer 01 ff 0a 00 00 00 00 00 20 4d 01 00>
[13654,483404295] Sending Read Packet SEQ 2
[13658,989687579 192.168.11.253] PacketTimeout called with type read and seq 2
[13658,989849586 192.168.11.253] READ TIMEOUT on sequence number 2
[13658,990198258 192.168.11.253] ReadResponse called
[13658,990618274] Timeout error - zero length packet
[13658,990728828 192.168.11.253] Read Time is 4 seconds and 508.9 ms.
[13658,990995231 192.168.11.253] Every packet done sending
[13658,991520979] Logging a Bad Quality thePointer 0
[13658,991625825] Logging a Bad Quality thePointer 0
[13658,991704333] Logging a Bad Quality thePointer 0
[13658,991773858] Logging a Bad Quality thePointer 0
[13658,991837977] Logging a Bad Quality thePointer 0
[13658,991892822 192.168.11.253] Address M0,5 has value false,false,false,false,false and quality BAD 255,BAD 255,BAD 255,BAD 255,BAD 255
[13658,991984928 192.168.11.253] We are calling back our readDoneCallback.
SOMETHING WENT WRONG READING VALUES!!!!
{ TEST1: [ 'BAD 255', 'BAD 255', 'BAD 255', 'BAD 255', 'BAD 255' ] }
-- end output --