Member Login
member
passwd
remember me on
this computer.

- join now -
- forgot username or password? -

Search

Jump to a Date

Sponsored Communities
Cool stuff
Select a topic of interest:
...and press:
Neat Stuff
Control.com Stuff

Visit our shop for nerds in control lifestyle products.

Fortune
Cauliflower is nothing but Cabbage with a College Education.
-- Mark Twain
RSS Feed
RSS feed Use this link to get an RSS feed of the Control.com article flow, for private, non-commercial use only:
www.control.com/rss/
To get a personalized feed, become a member at no cost.
Select a Page Style
Select one of the following styles:
- BluFu
- Classic
(cookies required)
advertisement
from the Automation List department...
Receiving data from a weighing scale using RS232 with VB 6 App
Communications systems and equipment. topic
Posted by CLD on 12 January, 2007 - 1:28 am
I have a digital weighing scale I need to connect to the PC using RS232 communication port. Every time I weigh an object, automatically the result/weight will display in the the texbox control in Visual Basic Application that I made. I need your help for the complete source code that will communicate to the weighing device and what control shuold I use to communicate and how?


Posted by Robert Scott on 12 January, 2007 - 10:26 pm
Start by reading the manual for your particular scale. Each brand of scale is different (Mettler, Sartorius, etc.) That will tell you how to parse the output.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting


Posted by Anonymous on 23 January, 2007 - 10:52 pm
You can use "mscomm control" to receive data from weight scale using rs232. The onComm event is used to receive data from serial port, and for more help follow the link:

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

Pls send feedback to me.


Posted by xmahmoud on 28 January, 2007 - 3:11 pm
please if u have the the module send it to me
xmahmoud@gega.net


Posted by AdvanLiew on 4 February, 2007 - 7:47 pm
I use to receive data via a timer for continous looping sequence output to a textbox. Things do goes bad, as it flicking all the way. I using a indicator from AD series which read data from load cell of a truck weight bridge. It there's any way to stop this flicking without effecting the continous loop?


Posted by Anonymous on 17 February, 2007 - 12:12 am
I have the same problem. If anybody can help please. I've bin battling with this for a long time.


Posted by Sam B on 16 February, 2007 - 11:03 pm
In putting the light... Most of all the electronic weighing scales are equiped with the RS232 monitor, and nn your application you need to place a MSCommunicator to your Windows form or User control from your toolbox. These two objects will communicate, and you can handle the
hand shaking between the two object in your form by checking the MSComm1.PortOpen. From here you can take a decision. In most cases it is better to use the timer in monitoring the above mentioned object. I will send you the real code if you email me on Sam.Nkosi @ webmail. co. za


Posted by EMD Productions on 19 February, 2007 - 10:39 pm
Start searching for especific scale serial output format. Using MSCOMM32 control from VB6 like:

MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,7,2"
MSComm1.InputMode = comInputModeText
MSComm1.InputLen = 0 'all buffer from port
MSComm1.NullDiscard = True
'Use in Sub MSComm_OnComm() all string conversion and port reading.

If you need more I can send more. Write me.


Posted by Anonymous on 25 February, 2007 - 10:41 am
Hi, the main problem im having is that the data input from the scale indicator to the mscomm contol is that the reading (weight) is not in a readable text and it flows throught there its not a fixed variable, the scale output is ascii. i received this information from the scale manufacturer. because i am very new to the mscomm control and not too good with this typr of coding pleas can any1 help me make heads or tails of how to put the codeing together.

1. Shekel Merav models 1000, 2000, 3000, 3001, 4000 and Caesar 2000, 3000, 3001,5000/1/3. Models use digital board ‘Tiger’, ‘Arnav’.

2. The Merav has serial communication RS-232 to computer and printer.

3. The communiction is bi directional from indicator to computer and vice versa.

4. There are three communication modes:
4.1 Response to weight request – “W” 57 H from host.
4.2 Continuous weight transmmision.
4.3 Manual transmmision – (Print).

5. The indicator has additional 2 features.
5.1 Zero the display in response to – Z – 5A
5.2 Set the Tare in response to – T – 54.

6. Programmable Baud Rate: Tiger 600 – 9600 Arnav 600 – 2400

7. Programmable Parity: 0 - space
1 - EVEN
2 - Mark
3 - ODD

8. 7 or 8 data bits, 1 stop bit.

9. The data is transmitted in ASCII code.

10. Data String:
10.1 Positive weight  (+) XXX.XXX CR
10.2 Negative weight  (-) XXX.XXX CR

11. Connector D type 25 : Pinout: Pin 2 - Data in
Pin 3 - Data out
Pin 7 - GND

12. Commector D type9: Pinout Pin 2 - Data out
Pin 3 - Data in
Pin 5 - GND

Thanks


Posted by Michael Griffin on 25 February, 2007 - 7:14 pm
I have done weigh scales with Python rather than MS-VB, so I can't give you cut and paste code examples. However, I assume from your description of your problem in your first sentence that you don't know how to extract the number from the ASCII text output.

With the type of scales I have worked with, the text output before and after the weigh reading is not always exactly the same, so it required a pattern matching algorithm to extract the weight. I used a regular expression to find and extract the weight, which was then easy to convert from text to an integer. I don't know what sort of regular expression library support you have in MS-VB6, but in Python it took only half a dozen of lines of code to read the scale.

One other point is that the scale output didn't have any message delimiters, so the only way to tell if the scale was done sending was to wait for a fixed period of time and then try to extract the weight. This worked fairly well provided you wait longer than the minimum time you really need. You probably need to set up a test to print out the exact message from the scale, and then try shorter and shorter time delays until you start cutting the message off (then double this time to have a margin).


Posted by HARRY HUNJAN on 1 June, 2007 - 11:06 pm
Pls help me by sending complete code.

Harry Hunjan


Posted by Gautham on 15 November, 2007 - 2:22 pm
Dear Sir/Madam,

Please make your codings more precise with steps
to be followed for designing and as well as coding. Opening & Closing Ports, Sending & Receiving/Reading RS232 codes, etc...

What if the weighing scale is replaced with a
Audio Visual Device having RS232 port?

gautham_an@rediffmail.com

Thanks & regards
Gautham


Posted by hi on 3 December, 2007 - 11:45 pm
Dear sir,

I want to receive data from rs232 to text box in visual basic studio.


Posted by iyn on 4 November, 2008 - 5:18 pm
I know my input is rs232, but I don't know it is in which format, baudrate. Could you please help me to capture the data transmission using VB 6?

When I use mscomm1 it is receiving some characters only.

Regards,
Iyn


Posted by Abhijit on 11 August, 2007 - 1:29 am
Can you provide details regarding which scale you have with regards to Manufacturer and Model?


Posted by vissu on 28 August, 2007 - 4:27 pm
Hi,

I am also trying the same thing with vs.net 2005.
What am I looking for? I have a weighing scale which will give lt, wt, depth, ht, etc. I have a system with .net 2005. Using RS 232 cable I am trying to get those data from scale to my application. Using serial port class I am configuring the com and then I am taking the data from the scale.

Problem facing me:
Step 1: In my .net Windows application, I click an Activate button. In this I had written a code to:
a. Send a request to scale
b. Scale will send an acknowledgement as * to my application.
c. Then user will keep a weight in scale and click Print button in device.
d. In my application I kept a message button which user can click to perform above step.
e. Then I am getting the bytes of data to my application and am storing that information in my database.

Now problem is:
On 2nd time if user has kept another weight in scale and user clicks a Print button then it's not getting that data. I kept a while (True) loop.

How can I achieve this in my application? Is there any way to achieve that 2nd, 3rd... data from scale without restarting com port repeatedly?

If you have some code for this and can give it to me, it will be very helpful to me.


Posted by alwi on 30 September, 2007 - 10:35 pm
just contact my email, ijust get a project with the same problem like you. i can send u the complete source. alwi_segaf@yahoo.com


Posted by Afzan on 3 January, 2008 - 5:36 pm
I want to build a system that receives data from a weighing scale. What type of electonic weight scale is suitable? And can I have coding?

From Control Engineering magazine...
Related articles from Control Engineering magazine
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.

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

Internet Explorer 6.0 Fix

Advertisement
Our Advertisers
Help keep our servers running...
Patronize our advertisers!