advertisement
from the electrical department...
Help!! to read remote meters using LAN in VB6.0
Communications systems and equipment. topic
Posted by Amit on 19 October, 2012 - 2:37 am
I am trying to implement remote metering using socket in vb 6.0 from different IPs of LAN. But the problem is in some cases getting negative value for big readings. In some cases results are abnormal.

I have used SerialServer(HMS) modbus RTU and L&T meters with RS 485.
Pl help me.

Otherwise advice for better program in VB6.0 or other.


Posted by Computer Egghead on 13 November, 2012 - 5:54 pm
You are probably reading integers and need to use long integers.


Posted by Lynn August Linse on 14 November, 2012 - 9:53 am
Older Visual Basic (& Python & many 'modern' human-oriented languages) lack the notion of 'unsigned integer'.

So by default, if you convert a 16-bit integer to VB, you'll see -32768 to 32767. This is problem if 0xFFFF means 65,535 and NOT -1.

You should do some Google/Bing research on importing data into VB. Since the Modbus message really comes in as a binary string, you probably have to manually convert the 2 (or 4) bytes into an Integer if 16-bit/2-byte as the VB Integer is signed 32-bit, or Long if 32-bit/4-byte as the VB Long Integer is signed 64-bit.

Now I think around VS 2005 they introduced the types of UInteger and ULong, but you are safer to use normal Integer & Long since not all VB add ons will be expecting unsigned data.


Posted by Mark on 15 November, 2012 - 12:30 pm
Refer to this MS technote:

http://support.microsoft.com/kb/189323

-Mark
http://automatedsolutions.com

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-2013 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
Spouse, n.:
Someone who'll stand by you through all the trouble you
wouldn't have had if you'd stayed single.
Advertise here
advertisements
Servo, stepping motor control, analog & web HMI in one system!
Control.com is the largest Automation community on the web. Learn how to advertise here now...
Servo, steppers, analog, digital & web HMI - Fully Integrated!
Time to incorporate data handling, web HMI and motion in one system!
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive