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
Duane P. Bozart #2 / 3
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
Duane P. Bozart #3 / 3
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...