473,791 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! Digital Scale on Serial With MSComm Controll

5 New Member
Hi.

Im pretty new to the mscomm controll and my problem is.

Im trying to connecting a weighbridge to Com1 and when i try read the weight on the scale i get a mass of garbage coming trough.

but when i unplug the loadcell and the indicator reads Error-02, it displays in the application but its not fixed it rolls through

Iv bin batteling with this for a long time

Any help or input would b much appreciated.

Thanks

G.Masson
Feb 16 '07 #1
4 8952
willakawill
1,646 Top Contributor
Hi. Is there an API that comes with this device? Is there an interface that comes with it? Is there a guide that comes with it to let you know how to format the data?
Feb 17 '07 #2
GaryMasson
5 New Member
Hi. Is there an API that comes with this device? Is there an interface that comes with it? Is there a guide that comes with it to let you know how to format the data?
hi.

There are no manuals or anything that come with the device, or anything, when the mscomm reads from the device the data comes through scrambled and unreadable, as text, symbols, and numbers mixed.

Thanks
Feb 19 '07 #3
GaryMasson
5 New Member
I received the following information from the scale manufacturer. and i cannot make heads or tails of whats going on. as i said b4 i am totally new to the mscomm and serial communicaton. if you could please help me set up the code so the input goes into a text box via the oncomm facility. i really am green to all this.

Merav – communication Protocol
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
Feb 19 '07 #4
GaryMasson
5 New Member
Hi

I sum1 directed me to a sample on the microsoft web. and received the following code:

Const Xon = &H11
Const Xoff = &H13

Private Sub Form_Load()
Form1.Caption = "App2"
With MSComm1
.CommPort = 2
.Handshaking = 2 - comRTS
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1 "
.SThreshold = 1
.PortOpen = True
End With
Text1.Text = ""
Label1.Caption = "No input yet"
End Sub

Private Sub Form_Unload(Can cel As Integer)
MSComm1.PortOpe n = False
End Sub

Private Sub MSComm1_OnComm( )
Dim InBuff As String

Select Case MSComm1.CommEve nt
' Handle each event or error by placing
' code below each case statement.

' This template is found in the Example
' section of the OnComm event help topic
' in VB help.

' Errors
Case comEventBreak ' A Break was received.
Case comEventCDTO ' CD (RLSD) Timeout.
Case comEventCTSTO ' CTS Timeout.
Case comEventDSRTO ' DSR Timeout.
Case comEventFrame ' Framing Error
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParit y ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]

' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of chars.
Label1.Caption = "Input"
InBuff = MSComm1.Input
Call ParseChars(InBu ff)
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Case comEvEOF ' An EOF character was found in
' the input stream.
End Select

End Sub

Sub HandleInput(InB uff As String)
' This is where you will process your input. This
' includes trapping characters, parsing strings,
' separating data fields, etc. For this case, you
' are simply going to display the data in the text
' box.

Text1.Text = Text1.Text & InBuff
End Sub

Sub ParseChars(ByVa l InString As String)
Dim temp As String
Dim x As Long
Dim OutString As String

For x = 1 To Len(InString)
temp = Mid$(InString, x, 1)
If temp = Chr$(Xoff) Then
Label1.ForeColo r = vbRed
Label1.Caption = "Xoff received"
temp = ""
ElseIf temp = Chr$(Xon) Then
Label1.ForeColo r = vbGreen
Label1.Caption = "Xon received"
temp = ""
End If
OutString = OutString & temp
temp = ""
Next x
Call HandleInput(Out String)
End Sub


Would this work for what am doing or are there sum modifications i need to make. i understand the basics behind the coding but im still not sure i know what im doing.

Any help appreciated

Thanks

G Masson
Feb 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1054
by: John Bonds | last post by:
I'm looking for some sort of usb digital scale kinda like ones used for weighing mail. Can anyone recommend anything? Thanks, John
3
7296
by: John Bonds | last post by:
I'm looking for some sort of digital scale to integrate into .NET. Does anybody know of anything (like a postal scale) that attaches to USB, serial or whatever that comes with a DLL or an API that I could integrate into .NET? Thanks, John
0
2486
by: David | last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003 application when attempting to open serial comms ports. The application has 2 ports that connect via serial cable to 2 different hardware devices to transfer binary data to the application. The setup screen enables the user to select COM1 -- COM8 via combo boax for each port. Then they click "Apply" to open the ports. The code that I have written to open the...
2
2538
by: ken | last post by:
Hello everyone, I'm new to visual VB and I am trying to setup communications using the Function ReceiveSerialData() As String example found in the help section of Microsoft Visual Basic 2005 Express Edition. Sample Code: Function ReceiveSerialData() As String ' Receive strings from a serial port. Dim returnStr As String = ""
0
973
by: tchitra1 | last post by:
I am using VB programme to communicate to PLC. I am able to communicate using hyper terminal for 'n' no. of cycles (sending and receiving) but thru the VB application using MS COMM, the communication is perfect only for the first cycle. After completion of first cycle, I am receiving completion signals from PLC and the application sends signals for the second cycle. There is no response from the PLC from next cycle onwards. Can anyone help...
5
2684
by: chapeau_melon | last post by:
Hello, I'm basicly not a programmer... I found some C++ codes on the net that almost satisfy me needs, wich is to communicate with an other device that sends data to me, wich I have to receive and save into a file. But here is the problem : I have a copy of the MS-DOS KERMIT communication program.
1
1743
by: hemant kamble | last post by:
Hi all, I am hemant , I am new for VB. Can sombody help to access serial port in VB on windows XP. I am trying with Ports.bas but ididn't get success kindly anybody give code for access serial port on XP. Thanks.
0
1065
by: hemant kamble | last post by:
Hi all, I am hemant , I am new for VB. Can sombody help to access serial port in VB on windows XP. I am trying with Ports.bas but ididn't get success kindly anybody give code for access serial port on XP. Thanks
3
1145
by: hamidd66 | last post by:
hello dear i have some problems about working with serial port would you please send me an tutorial or an article about serial port and its functions in c# thanks
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.