Firstly, before you start to code anything, I would check whether you're using the right cable. Try open a serial terminal of your choice (HyperTerm, putty) and check whether there is any data at all. Be sure to configure the same baudrate, stopbits and parity on both the weight scale and your terminal program.
Hi, I understand that you want to capture Mettler Toledo RS232 port weight data in a VB.NET application. And you are after source code for VB.NET. To query the scale, you need to send an ASCII command: S To process the returned weight: S S 0.000 lb S S 0.000 g It would be best to extract the value and the units and then implemenmt a switch statement on the units toi convert to a standard weight. I would suggest reading the captured string into a string seperator using space ' ' as the delimiter such that str0 = 'S' str1 = 'S' str2 = '0.000' str3 = 'lb g kg.' Then process the result Which version of VB are you using? - I might be able to supply VB.NET 2008 code.
Www.earthed.net.au [email protected]. Ultimately what is your goal, i.e. What are you going to do with the data? If you are using it in an automated process of some kind you might want to consider useing and OPC Server like Kepware's UCON Protocol Server. UCON stands for User Configurable. You can can create the request and response handling and then connect to the server via any SCADA Client or via VB.Net if you wish. The process is similar to the VB.Net code example that was presented.
Just another option to consider. Fred Loveless Senior Application Engineer Kepware Technologies. Did anyone solve this, if you have can you email me the code too pls, [email protected] This will read the weight on the mettler scale on the serial port. Put this Function in and call it. Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function.
This will read the weight on the mettler scale on the serial port. Put this Function in and call it. Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function You will also need this in the class Public Shared STX = Chr(2)' ascii start of text Public Shared CR = Chr(13) 'ascii Carriage Return. Sorry, but I don't know, why use: comPort.Write('P') This will read the weight on the mettler scale on the serial port. Put this Function in and call it. Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function.
You have clicked on the '?' Button for search help.
To search the site, enter your search terms in the box labeled 'search the site' and hit Enter. Some tips for better search results. Precede each search term with a '+', as follows:.
+Modbus +TCP Otherwise, any post with either term will match. Use double quotes around phrases, as follows:. +'Allen Bradley' +ethernetOtherwise, posts containing these words in separate locations will match. To exclude a word, precede it with a '-', as follows:.
+Modbus -Plus This will return only posts containing 'Modbus' but NOT containing 'Plus'. Note that common words (and, that, etc.) and words shorter than 2 characters are automatically excluded from searches. Select the categories for which you would like to see messages displayed. Applications Application Questions and Problems Automation Business The Business of Automation and Control Communications Communications systems and equipment. Engineering Engineering and workplace issues. HMI Human-Machine Interface and SCADA.
Information Information resources, documentation. Languages Programming languages. Motion Control Motion control, servos, steppers, etc. Networking Local and wide area networking in factory automation. Open Control Open interfaces, software and hardware PCs in Automation Computers in manufacturing; also hardware discussion.
PLCs PLCs and related questions. Power Generation Power generation equipment control. Process Control Continuous process industries, DCS questions. Sensors Sensor technologies. Software in Automation Software, including programming, OS issues, etc.
Hi, I understand that you want to capture Mettler Toledo RS232 port weight data in a VB.NET application. And you are after source code for VB.NET. To query the scale, you need to send an ASCII command: S To process the returned weight: S S 0.000 lb S S 0.000 g It would be best to extract the value and the units and then implemenmt a switch statement on the units toi convert to a standard weight. I would suggest reading the captured string into a string seperator using space ' ' as the delimiter such that str0 = 'S' str1 = 'S' str2 = '0.000' str3 = 'lb g kg.' Then process the result Which version of VB are you using? - I might be able to supply VB.NET 2008 code.
Www.earthed.net.au [email protected]. Ultimately what is your goal, i.e. What are you going to do with the data? If you are using it in an automated process of some kind you might want to consider useing and OPC Server like Kepware's UCON Protocol Server. UCON stands for User Configurable. You can can create the request and response handling and then connect to the server via any SCADA Client or via VB.Net if you wish.
The process is similar to the VB.Net code example that was presented. Just another option to consider.
Fred Loveless Senior Application Engineer Kepware Technologies. Did anyone solve this, if you have can you email me the code too pls, [email protected] This will read the weight on the mettler scale on the serial port. Put this Function in and call it.
Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function. This will read the weight on the mettler scale on the serial port. Put this Function in and call it.
Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function You will also need this in the class Public Shared STX = Chr(2)' ascii start of text Public Shared CR = Chr(13) 'ascii Carriage Return. Sorry, but I don't know, why use: comPort.Write('P') This will read the weight on the mettler scale on the serial port. Put this Function in and call it.
Private Function getlbs As String Dim buffer As New StringBuilder Dim comPort As New SerialPort('COM1', 9600, Parity.None, 8, StopBits.One) comPort.Open comPort.Write(STX) mytimer(1) comPort.Write('P') mytimer(1) comPort.Write(CR) mytimer(1) Dim line As String = comPort.ReadExisting comPort.Close Return isnum(Trim(line)) End Function. You have clicked on the '?' Button for search help. To search the site, enter your search terms in the box labeled 'search the site' and hit Enter. Some tips for better search results. Precede each search term with a '+', as follows:.
+Modbus +TCP Otherwise, any post with either term will match. Use double quotes around phrases, as follows:. +'Allen Bradley' +ethernetOtherwise, posts containing these words in separate locations will match. To exclude a word, precede it with a '-', as follows:.
+Modbus -Plus This will return only posts containing 'Modbus' but NOT containing 'Plus'. Note that common words (and, that, etc.) and words shorter than 2 characters are automatically excluded from searches. Select the categories for which you would like to see messages displayed. Applications Application Questions and Problems Automation Business The Business of Automation and Control Communications Communications systems and equipment. Engineering Engineering and workplace issues. HMI Human-Machine Interface and SCADA.
Information Information resources, documentation. Languages Programming languages. Motion Control Motion control, servos, steppers, etc. Networking Local and wide area networking in factory automation. Open Control Open interfaces, software and hardware PCs in Automation Computers in manufacturing; also hardware discussion. PLCs PLCs and related questions.
Power Generation Power generation equipment control. Process Control Continuous process industries, DCS questions.
Sensors Sensor technologies. Software in Automation Software, including programming, OS issues, etc.