Member Login
Search
Jump to a Date
Sponsored Communities
Cool stuff
Neat Stuff

Visit our shop for nerds in control lifestyle products.
Thermal Overload
The threads that wouldn't die...
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
Fortune
Court, n.:
A place where they dispense with justice.
-- Arthur Train
A place where they dispense with justice.
-- Arthur Train
RSS Feed
www.control.com/rss/
To get a personalized feed, become a member at no cost.
Hi, I'm trying to read data from a PM500 power meter, I'm using java to get connected, the connection is fine. the problem is I don't know the correct format to send the request to the device, the code is the following:
InetAddress ipaddress = InetAddress.getByAddress("192.168.8.42", new byte[]{(byte)192, (byte)168, (byte)8, (byte)42});
Socket xocket = new Socket(ipaddress, 771);
OutputStream output = xocket.getOutputStream();
BufferedInputStream input = new BufferedInputStream(xocket.getInputStream());
byte buffer[] = new byte[261];
DataOutputStream dos = new DataOutputStream(output);
//Here is the problem, the request I want to do is
// 01 03 03 00 00 62 C4 67, and I don't know how to build the request buffer
dos.writeByte(1); // device id
dos.writeShort(3);// function
dos.writeByte(0x0300);//register to start
dos.writeByte(0x0062); // register to end
dos.writeByte(0xC467); // crc
output.flush();
int totalRead = input.read(buffer, 0, 261);
The response I always get is -1208011111411632105115321111171163211110232114971101031010
Any idea of how to build the request buffer correctly or some code sample? I tried using jamod but I get lot of errors when I send the request, so I decided used my own code.
thanks in advance
gishac
InetAddress ipaddress = InetAddress.getByAddress("192.168.8.42", new byte[]{(byte)192, (byte)168, (byte)8, (byte)42});
Socket xocket = new Socket(ipaddress, 771);
OutputStream output = xocket.getOutputStream();
BufferedInputStream input = new BufferedInputStream(xocket.getInputStream());
byte buffer[] = new byte[261];
DataOutputStream dos = new DataOutputStream(output);
//Here is the problem, the request I want to do is
// 01 03 03 00 00 62 C4 67, and I don't know how to build the request buffer
dos.writeByte(1); // device id
dos.writeShort(3);// function
dos.writeByte(0x0300);//register to start
dos.writeByte(0x0062); // register to end
dos.writeByte(0xC467); // crc
output.flush();
int totalRead = input.read(buffer, 0, 261);
The response I always get is -1208011111411632105115321111171163211110232114971101031010
Any idea of how to build the request buffer correctly or some code sample? I tried using jamod but I get lot of errors when I send the request, so I decided used my own code.
thanks in advance
gishac
Try to rebuild the code in a new the 552 series.
I must use PM500 series. Any idea of how to send the request???
Hi gishac,
I'm trying to do the same thing... I found this tutorial that helps you to make a java applet that can connect to your device...
http://ltxfaq.custhelp.com/cgi-bin/ltxfaq.cfg/php/enduser/std_adp. php?p_faqid=943&p_created=1075227796&p_sid=NoP2jG7j&p_accessi bility=0&p_redirect=&p_lva=&p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZw X2dyaWRzb3J0PSZwX3Jvd19jbnQ9MSZwX3Byb2RzPTAmcF9jYXRzPSZwX3B2PSZwX2N2PSZwX 3NlYXJjaF90eXBlPWFuc3dlcnMuYV9pZCZwX3BhZ2U9MSZwX3NlYXJjaF90ZXh0PTk0Mw**&a mp;p_li=&p_topview=1
But the only problem I'm having is that I receive the data in ASCII and I have to change it to Decimal.
I'm trying to do the same thing... I found this tutorial that helps you to make a java applet that can connect to your device...
http://ltxfaq.custhelp.com/cgi-bin/ltxfaq.cfg/php/enduser/std_adp. php?p_faqid=943&p_created=1075227796&p_sid=NoP2jG7j&p_accessi bility=0&p_redirect=&p_lva=&p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZw X2dyaWRzb3J0PSZwX3Jvd19jbnQ9MSZwX3Byb2RzPTAmcF9jYXRzPSZwX3B2PSZwX2N2PSZwX 3NlYXJjaF90eXBlPWFuc3dlcnMuYV9pZCZwX3BhZ2U9MSZwX3NlYXJjaF90ZXh0PTk0Mw**&a mp;p_li=&p_topview=1
But the only problem I'm having is that I receive the data in ASCII and I have to change it to Decimal.
Hey,
I was able to create a Java Modbus library just by working from the online specs. If you need to understand what the packets contain you should really take a look at them.
It is fairly straight forward to create the packets once you know what they look like.
Let me know if you have questions.
I was able to create a Java Modbus library just by working from the online specs. If you need to understand what the packets contain you should really take a look at them.
It is fairly straight forward to create the packets once you know what they look like.
Let me know if you have questions.
From Control Engineering magazine...
Related articles from Control
Engineering magazine- Growth: Expansions, acquisitions in U.S., abroad
- Industrial Ethernet applications in real time
- Listen In: How Enterasys industrial Ethernet switches improve cyber security
- Fluke: How to improve industrial network health at 3 levels
- New Webcast: Bridging gaps with wireless
- Automation and Ethernet Combine for 3D Disney Attraction
- Soon after IEC OKs WirelessHART, Emerson ships; BP expands wireless use; innovative applications
- Industrial networking: Partnership to enhance wireless technologies for industrial use
- Integration: 2 efforts use Internet protocol for industrial networks
- RFID, automation: One company’s trash is another’s competitive advantage
Above articles copyright 2008 Reed Business Information.
Subject to its Terms of Use.
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2008 Control Technology Corporation. All rights reserved.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Patronize our advertisers!




