Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommRead data with unknown length
Hi
there are many good tutorial for communication with the serial port via VBA like http://www.thescarms.com/vbasic/commio.aspx or http://dev.emcelettronica.com/serial...tion-excel-vba All of them seems to use something like CommRead(intPortID, strData, lngSize) But my device sends data with unknown length. Is there a way to implement an wrapper for CommRead that bypass the lngsize, so that i can read the whole string sended? thx Christof |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommRead data with unknown length
On Thu, 20 Sep 2012 17:13:42 +0200, Christof Kluß wrote:
Hi there are many good tutorial for communication with the serial port via VBA like http://www.thescarms.com/vbasic/commio.aspx or http://dev.emcelettronica.com/serial...tion-excel-vba All of them seems to use something like CommRead(intPortID, strData, lngSize) But my device sends data with unknown length. Is there a way to implement an wrapper for CommRead that bypass the lngsize, so that i can read the whole string sended? thx Christof How does the device terminate what ever it is it sends? If that's known, you should be able to read a character at a time, concatenating them together, until you get the "end of data" indicator... Bruce |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommRead data with unknown length
Hi Bruce
Am 20-09-2012 20:10, schrieb Bruce Bowler: On Thu, 20 Sep 2012 17:13:42 +0200, Christof Kluß wrote: How does the device terminate what ever it is it sends? If that's known, you should be able to read a character at a time, concatenating them together, until you get the "end of data" indicator... I only know that the output comes in lines that end with "CRLF", but it is not set how many lines. Perhaps I can read until long time nothing comes (after a CRLF)? Do you have an idea how to do this? Probably, like you said, I have to read one character at time, but how do I know, if I am out of time? Do lngStatus = CommRead(intPortID, strData, 1) buffer = buffer & strData ... Loop Until outoftime Christof |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommRead data with unknown length
Is there a way to implement a SerialPort.ReadExisting in VBA? For NET there is http://msdn.microsoft.com/library/sy...dexisting.aspx Am 20-09-2012 20:37, schrieb Christof Kluß: Hi Bruce Am 20-09-2012 20:10, schrieb Bruce Bowler: On Thu, 20 Sep 2012 17:13:42 +0200, Christof Kluß wrote: How does the device terminate what ever it is it sends? If that's known, you should be able to read a character at a time, concatenating them together, until you get the "end of data" indicator... I only know that the output comes in lines that end with "CRLF", but it is not set how many lines. Perhaps I can read until long time nothing comes (after a CRLF)? Do you have an idea how to do this? Probably, like you said, I have to read one character at time, but how do I know, if I am out of time? Do lngStatus = CommRead(intPortID, strData, 1) buffer = buffer & strData ... Loop Until outoftime Christof |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unknown column length | Excel Programming | |||
Finding a string of unknown length in a string of unknown length, Help! | Excel Discussion (Misc queries) | |||
Unknown column length | Excel Programming | |||
SMALL() on unknown length of list | Excel Worksheet Functions | |||
Sum unknown length column data in VBA | Excel Programming |