Receiving data from a weighing scale using RS232 with VB 6 App

C

Thread Starter

CLD

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?
 
R

Robert Scott

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
 
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?
 
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
 
I have the same problem. If anybody can help please. I've bin battling with this for a long time.
 
E

EMD Productions

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.
 
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
 
M

Michael Griffin

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).
 
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.
 
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?

[email protected]

Thanks & regards
Gautham
 
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?
 
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
 
Dear Sir:

I read your post. on 16 February, 2007 - 11:03 pm. You told another person how to develop program to read and display information from a weighing indicator. Therefore, I thought you could help me too.
I have exactly the same problem. I am a beginner and would like to develop the same application using Visual Basic 2008. However, I really don't know how to start. i have worked hours with the software but I didn't make it. I am wondering if you could tell how I should do and maybe you could also give me a source code. Please find attached the technical manual of the indicator. The serial ports specifications can be found in pages 23 and 24.

Best regards
Ali
 
Hiya,

you may be able to help me, basically I need python scripts to help read a voltage reading...I have a Rs232 connected to a circuit, that will read force...(weight of a human)...I need a python script that will output the data, but having troubles in doing so... If you could assist, that would be great.
 
Top