Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mscomm

Status
Not open for further replies.

lode

Programmer
Nov 8, 2001
208
BE
Hi,

At my work we have a device that shows the weight off a truck.
Now i want to write a vb prog to read out the value on the display.

Mscomm ??

Any suggestions ?

Thanks.
 
You may need to show a it more detail of what your problem is. However a quick search on the forum yields:

thread222-809987
thread222-772706
thread222-462962

dealing with different aspects of weighing devices

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Well,
I have to read the comm port and the output has to be something like 45200 kg.
I really don't have any idea how to do that.
I know something about the Mscomm control but do i have to test it first and then tell you what the result is ?
 
There is a sample in MSDN called 'dialer.vbp' which is a nice place to get you started in using mscomm. But i think you won't need the dialing(sending) part. Here is a simple example on most probably what u need:

Set your MsComm1 properites:
MSComm1.CommPort = 1
MSComm1.InputMode = comInputModeText
MSComm1.InputLen = 0
MSComm1.RThreshold = 20 ' No. of character to recevie.
MSComm1.Settings = 9600,n,8,1

Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
Dim MyData As String

Select Case MSComm1.CommEvent
Case comEvReceive ' Receive event.
MyData = MSComm1.Input
End Select

' Store MyData to wherever you want.
End Sub

Hope this helps.
 
I'll trie,

Thanks for your reply.
 
Hi,

Today i tried the code from toyumail but i don't receive any signal from the device.
I changed the number of the commport but no result.
It's a Philips PR1613 weighing device.
Can somebody please help me out ??

P.S. the program we're using now is written in cobol but i don't know anything about this language.
 
First thing you'll want to check is that the weighing device serial output matches the baud rate, the data bits, stop bits and parity settings you have fot the com port.

Robert
 
Thanks for your reply !!
I will try this tommorow Vampire and give you an answer.
Please stay in touch with me.
I really have to find a solution !!!
Thanks again.
 
Here i'm again,

I found some information about the weighing device

Electrical specification
DUART controlled, usable for current loop-,RS232-,RS422/485-interface modules, ASCII coded, full duplex,asynchronous
Data rate : adjustable for 300,600,1200,4800 or 9600 b/s
Bits/character : settable for 7 or 8 bit
Start bits : one
Stop bits : one
Parity : settable for even, odd, none
Time out : no time limiting
Address Range : 26 addresses (A...Z)

COMMANDS
Read weight
WGA read gross weight --> reaction : QGA-WNA read net weight --> reaction : QNA-WTA read tare weight --> reaction : QTA-WDA read difference weight --> reaction : QDA-
I tried whole day today but nothing works,
it's getting so frustrating.
PLEASE HELP ME !!
 
So, what you have to do is match the settings you want to use for the COM port to the settings on the device. The device settings are probably done by DIP switches or the like.

After you've got that done, you have to send the appropriate command to the device to get it to send back a response. Something like this in the event for a command button click.

Private Sub Command1_Click()

MSCOMM1.Output = "WGA" & vbCrLf

End Sub

If everthing is set up correctly, when you click on the command button you should get a string in response to this ( in the OnComm event ) , in the format you listed above.

Hope this helps,

Robert
 
Thanks again Robert.
I will try as soon as possible.
Thanks a lot.
Maybe see you tomorrow !!

Best regards

Lode.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top