For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > December 2005 > MScomm, jpeg data,









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MScomm, jpeg data,
Boki

2005-12-15, 6:55 pm

Hi All,
I have to say sorry, the byte direct 2 pictureBox works very
nice!
Now, I am meeting another problem, I got data from Serial port, and it seems
not a correct jpg file ...

althouth I can ge tthe jpg header "FF D8" and EOF "FF D9" in the stream data
( serial port via mscomm)

I have tried to write data to disk to double check, but no program can load
it ( paint / photoshop /... )

I don't know why..

Does it possible to lost data when I set a not sutiable MScomm settings?

My input data is about 2K a time ( and I will collect them as a jpg
file ).... should I notice any setting ?

Best regards,
Boki.


=========

If (MSComm1.InBufferCount > 0) Then

Buffer = MSComm1.Input

For count_jpg = 0 To UBound(Buffer)

JPEG_Buffer(pointer+ count_jpg) = Buffer(count_jpg) ' I will
try to optimize this by MemoryCopy API when I have enough time...



Dick Grier

2005-12-15, 6:55 pm

Hi,
[color=darkred]
Does it possible to lost data when I set a not sutiable MScomm settings?
<<

You can loose data if you are not using flow control (.Handshaking = comRTS
is best). The device that is sending the data must also support hardware
flow control, certainly.

If you loose data, there will be an OnComm error event (CommEvent =
someerrornumber, often comEvRxOverflow).

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


Boki

2005-12-15, 9:55 pm

I have try it... but I dind't see that event..

Here are my new questions:

Q: When I set the InBufferSize = 1024 and InputLen = 1024 also, I still got
320bytes only a time.
Is that a limit of client ?

In fact, I don't understand too much about these two parameters .

Best regards,
Boki.

"Dick Grier" <dick_grierNOSPAM@msn.com> ¼¶¼g©ó¶l¥ó·s»D:eI916rZAGHA.504@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> Does it possible to lost data when I set a not sutiable MScomm settings?
> <<
>
> You can loose data if you are not using flow control (.Handshaking =
> comRTS is best). The device that is sending the data must also support
> hardware flow control, certainly.
>
> If you loose data, there will be an OnComm error event (CommEvent =
> someerrornumber, often comEvRxOverflow).
>
> Dick
>
> --
> Richard Grier (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
> www.mabry.com/vbpgser4 to order.
>
>



Dick Grier

2005-12-16, 6:56 pm

Hi,
[color=darkred]
InputLen = 1024
<<

Don't do that. Leave it at the default: 0. Any other setting will cause
trouble.

InBufferSize defines the amount of memory that Windows uses to buffer
receive data pending a read by your application. If your application does
not get around to reading it soon enough, there will be a receive overflow.
The maximum size is less than 32768.

InputLen defines the number of character that are returned when you call the
Input property. Zero (0) means to return ALL that are available, and this
is what you should do.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com