Closed Fvi589 closed 4 years ago
the de and org directories need to go at the same level as "com", under the "src" directory.
not sure about the modbus directory.
I adapted the code that I compiled with javac and it works, even if for the moment I make my frames by hand. I COM in modbus tcp and I have the same frames as easymodbus and I modify the values in the server.
how can i do that in lushproject please? Even if I have to take over all the frame structures, I do it !!! Paul-FVI - ModbusTcp.pdf
You need a try/catch block. Notice that in test3.java, the whole thing is enclosed in try { ... } catch (Exception e) { ... }
Unfortunately you don’t have access to the entire java runtime. Circuitjs gets converted to javascript using GWT. java.net is not included in the list of classes supported, because javascript code is not allowed to just make socket connections wherever it wants. Hmm...
Damned !!! :( So, it's not possible to com in modbus tcp ? big disappointment !!! :(
GAME OVER !!
GAME OVER, NEVER !!!! :) Paul, I started from Java sources, without GWT. And it works !!! VICTORY !!! I saw that it was version V1.6. I guess there have been a lot of changes since 2.2.13.
please, do you have the V2.2.13 file without gwt? I think no
I will try to wear all the new components step by step.
But I'm very happy because I don't need gwt for my apps. I will try to continue to wear my new components in the 2 versions.
THANK YOU VERY MUCH !!!! Franck VIARD
Great! Sorry, I have not updated the java version in a long time. The most recent versions all use GWT.
I saw there are some javascript-based modbus interfaces out there, so it might be possible if you want to use the latest version with GWT. Not sure how they work.
Hi, I would like to integrate this COM Modbus TCP, but that does not compile when I put it in a Java elements file. What should I do for this to compile?
Example : import java.io. ; import java.net. ; import java.util.*; .... // set up socket Socket es = new Socket("127.0.0.1",502); OutputStream os= es.getOutputStream(); FilterInputStream is = new BufferedInputStream(es.getInputStream()); byte obuf[] = new byte[261]; byte ibuf[] = new byte[261]; // send request os.write(obuf, 0, 12); // read response i = is.read(ibuf, 0, 261);
See : https://paginas.fe.up.pt/~pfs/recursos/plcs/modbus/sources.html
when I try it with javac (test3.java), it works, I communicate with my server.
Please, it's very important for me. Thanks. Paul-FVI [Modbus tcp].pdf
**PS: I adapted the code that I compiled with javac and it works, even if for the moment I make my frames by hand. I COM in modbus tcp and I have the same frames as easymodbus and I modify the values in the server.
how can i do that in lushproject please? Even if I have to take over all the frame structures, I do it !!!**
CODE : import java.io. ; import java.net. ; import java.util.*;
public class test3 { public static void main(String argv[]) { try { String ip_adrs = "127.0.0.1"; // set up socket Socket es = new Socket(ip_adrs,502); OutputStream os= es.getOutputStream(); FilterInputStream is = new BufferedInputStream(es.getInputStream()); byte obuf[] = new byte[261]; byte ibuf[] = new byte[261]; int c = 0; int i; // READ COIL Adr : 0 Quantify : 1 -> Req & Rep : TRAMES Ok avec easymodbus obuf[0] = 0x00; obuf[1] = 0x01; obuf[2] = 0x00; obuf[3] = 0x00; obuf[4] = 0x00; obuf[5] = 0x06; obuf[6] = 0x01; // Function Code obuf[7] = 0x01; // Start ADr obuf[8] = 0x00; obuf[9] = 0x00; // Quantité obuf[10] = 0x00; obuf[11] = 0x02;
/ WRITE COIL Adr : 0 Value : 1 -> Req & Rep : TRAMES Ok avec easymodbus obuf[0] = 0x00; obuf[1] = 0x01; obuf[2] = 0x00; obuf[3] = 0x00; obuf[4] = 0x00; obuf[5] = 0x06; obuf[6] = 0x01; obuf[7] = 0x05; obuf[8] = 0x00; obuf[9] = 0x00; obuf[10] = 0x00; obuf[11] = 0x01; / System.out.println("Request : "); for (int ind=0; ind < 12; ind++) System.out.format("0x%x ", obuf[ind]) ; System.out.println(" "); System.out.println("Attente Reponse .... ");
// send request os.write(obuf, 0, 12);
// read response i = is.read(ibuf, 0, 261); System.out.println("Taille Rep : "+i ); for (int ind=0; ind < i; ind++) System.out.format("0x%x ", ibuf[ind]);
// close down es.close(); } catch (Exception e) { System.out.println("exception :"+e); } }
}