Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unknown column length Jock Excel Programming 3 October 19th 09 01:52 PM
Finding a string of unknown length in a string of unknown length, Help! Hankjam[_2_] Excel Discussion (Misc queries) 8 July 3rd 08 06:49 PM
Unknown column length Jock Excel Programming 4 October 29th 07 02:28 PM
SMALL() on unknown length of list [email protected] Excel Worksheet Functions 9 November 1st 06 02:03 PM
Sum unknown length column data in VBA John[_80_] Excel Programming 3 June 26th 04 03:32 AM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"