Serial communication using MSCOMM 
Author Message
 Serial communication using MSCOMM

I am trying to write a function to extract data from a medical monitor.
I know that it requires a 52 byte string in that I need to send via the
".Output" of the MSComm32 control.
I have that 52 byte string in a file called "controlcode.bin" but I
can't work out how to fill a variable in VB with the bytes. If I cut and
paste from the open file then I end up with a variable that appears to
have just 2 characters in it (~1) - which I presume are the only
printable chars in the string.
I think I need a variant variable that contains a byte array but how do
I set that up?
Also, do I then need to terminate ".Output" with a chr(13) or vbCr? If
so how do I do that?

TIA

Dave



Tue, 11 May 2004 17:20:20 GMT  
 Serial communication using MSCOMM

Quote:

> I am trying to write a function to extract data from a medical monitor.
> I know that it requires a 52 byte string in that I need to send via the
> ".Output" of the MSComm32 control.
> I have that 52 byte string in a file called "controlcode.bin" but I
> can't work out how to fill a variable in VB with the bytes. If I cut and
> paste from the open file then I end up with a variable that appears to
> have just 2 characters in it (~1) - which I presume are the only
> printable chars in the string.
> I think I need a variant variable that contains a byte array but how do
> I set that up?
> Also, do I then need to terminate ".Output" with a chr(13) or vbCr? If
> so how do I do that?

Is the control string (the 52 bytes) fixed?  If so, why not simply place
it in a fixed character string in the code?  If not fixed, then you can
open your file and read it into either a byte array (see "get") or
string.  Whether you need a trailing cr or crlf pair will be dependent
on the device's protocol...you'll have to refer to the documentation on
it for that.

W/O further detail on the instrument, I don't have much else to offer...



Sat, 15 May 2004 01:09:58 GMT  
 Serial communication using MSCOMM

Quote:

> I am trying to write a function to extract data from a medical monitor.
> I know that it requires a 52 byte string in that I need to send via the
> ".Output" of the MSComm32 control.
> I have that 52 byte string in a file called "controlcode.bin" but I
> can't work out how to fill a variable in VB with the bytes. If I cut and
> paste from the open file then I end up with a variable that appears to
> have just 2 characters in it (~1) - which I presume are the only
> printable chars in the string.
> I think I need a variant variable that contains a byte array but how do
> I set that up?
> Also, do I then need to terminate ".Output" with a chr(13) or vbCr? If
> so how do I do that?

Is the control string (the 52 bytes) fixed?  If so, why not simply place
it in a fixed character string in the code?  If not fixed, then you can
open your file and read it into either a byte array (see "get") or
string.  Whether you need a trailing cr or crlf pair will be dependent
on the device's protocol...you'll have to refer to the documentation on
it for that.

W/O further detail on the instrument, I don't have much else to offer...



Sat, 15 May 2004 01:10:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problems with using the control MSComm for serial port communication

2. simple serial communication - mscomm.ocx

3. serial communication and MSCOMM

4. Any experts on Serial Communications with MSComm?

5. VB Communications, MSComm, Serial Ports and Modems...

6. Modem, serial port, MSComm and VB Communications

7. Serial port, MSComm, Modem and VB communication

8. Regarding MSComm Serial Communication Control version 2.1.0.1 (0/1)

9. Regarding MSComm Serial Communication Control version 2.1.0.1 [rz1.txt] (1/1)

10. Serial Communications with MSCOMM

11. MSComm or VB Programer's guide to Serial Communication

12. serial communication with MSComm

 

 
Powered by phpBB® Forum Software