recieve data from com1 vb 
Author Message
 recieve data from com1 vb

I have a scale that is connected to com1.  The only thing the scale
company has told me is that it is ascii characters and that %P is the
command to call the scale.  I need to write the first 8 characters
from what the scale send to c:\testing\weight.txt
I know you are supposed to use MSCOMM and I have seen basic code but
it doesn't seem to work, and I do not know where that %P goes.  PLEASE
HELP!!....

Ricky,



Sat, 12 Feb 2005 23:05:27 GMT  
 recieve data from com1 vb

Quote:

> I have a scale that is connected to com1.  The only thing the scale
> company has told me is that it is ascii characters and that %P is the
> command to call the scale.  I need to write the first 8 characters
> from what the scale send to c:\testing\weight.txt
> I know you are supposed to use MSCOMM and I have seen basic code but
> it doesn't seem to work, and I do not know where that %P goes.  PLEASE
> HELP!!....

Well, you'll have to at least know the serial port settings to get
anywhere at all, I'd wager (speed, word size, parity, ...)  Of course,
9600,n,8,1 is sorta' common but it could be most anything.

Put the %P in a variable and send it out the port--I'd guess follow w/CR
LF pair, but that could also be a variable to play with.



Sun, 13 Feb 2005 01:42:51 GMT  
 recieve data from com1 vb

Quote:

>I have a scale that is connected to com1.  The only thing the scale
>company has told me is that it is ascii characters and that %P is the
>command to call the scale.  I need to write the first 8 characters
>from what the scale send to c:\testing\weight.txt
>I know you are supposed to use MSCOMM and I have seen basic code but
>it doesn't seem to work, and I do not know where that %P goes.  PLEASE
>HELP!!....

>Ricky,


Depending on the scale being used, the "%P" may very well all that's required to
get the scale to respond - no CRLF needed.  

Look up the MSCOMM control in Help and determine how to read data from it and
send data to it.  As previously mentioned, you also need to know the serial line
parameters (speed, parity, stop bits) - the vendor should have provided that
info and a manual (usually with sample program snippets).  First call the vendor
and get the rest of the documentation, then go online and see if their web site
has code samples.
.  
Send the characters "%P" to the scale and read the response back from it.
MSCOMM can be used in either polled mode (you ask it for data when you expect
data to be there) or in event mode (it alerts the program that there's data to
be read).  Polled mode is probably simpler for a beginner, and you would only
expect data from the scale when you have sent a request to it.

If you were in Atlanta (instead of Columbus, MS), I could come by with some test
gear (laptop with RS-232 'sniffer' software, a hardware speed monitor, and a
breakout box) and probably have all the info you needed in a couple of hours.
It would cost you $50/hr, but that might be cheap considering the level of
frustration I read in your post ;-)

For more info on using the MSCOMM control, you may want to look at someone
else's code.  Go to
http://www.htservices.com/Tools/VisualBasic/SerialCommunications.htm and scan
the page for "Poor Man's Serial Instant Messenger".  Download the file and you
will have a very basic VB6 communications program that uses the MSCOMM control
to send and recieve data.  You should be able to adapt this to send the request
to the scale and read the response back from it.  You would get the response
into a string, then open the file and print the string to the file.  If you need
further help after exploring the program code, post or send email.

VB3 source code: http://thelabwiz.home.mindspring.com/vbsource.html
VB6 source code: http://thelabwiz.home.mindspring.com/vb6source.html
Fix the obvious to reply by email.



Tue, 15 Feb 2005 13:26:14 GMT  
 recieve data from com1 vb

Quote:

>I have a scale that is connected to com1.  The only thing the scale
>company has told me is that it is ascii characters and that %P is the
>command to call the scale.  I need to write the first 8 characters
>from what the scale send to c:\testing\weight.txt
>I know you are supposed to use MSCOMM and I have seen basic code but
>it doesn't seem to work, and I do not know where that %P goes.  PLEASE
>HELP!!....

>Ricky,


There are standards for scale communications.  A search on google for 'scale'
and 'serial' has http://www.scalemanufacturers.org/Standard.htm as the first
page - the Scale Manufacturers Association standards page.  It includes the SMA
Standard for Scale Serial Communications Protocol, a 50K PDF file which can be
downloaded.  It probably contains the standard configurations for sending
requests to, and receiving data from, the serial scale you're working with.

VB3 source code: http://thelabwiz.home.mindspring.com/vbsource.html
VB6 source code: http://thelabwiz.home.mindspring.com/vb6source.html
Fix the obvious to reply by email.



Tue, 15 Feb 2005 14:48:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MSComm does not recieve data when Hyper Terminal recieves data OK

2. How to get data from COM1 or COM2 (use VB)

3. recieve data asynchronously and send the data on the same socket

4. Capture data from COM1

5. reading data from COM1

6. Qbasic - Get data from Com1

7. Reading Data from com1

8. Reading data from com1

9. Help with receiving data on COM1

10. loosing data sending from com1 to com2 on same PC

11. real time data reading from com1 and com2 port

12. How to get data from COM1 or COM2

 

 
Powered by phpBB® Forum Software