Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/07/02 09:57
Read: times


 
#24081 - RE: serial data format problem
I think this problem lies in the fact that VB uses unicode characters (wide-char), which have a 2-byte length per char. Hence for standard alphanumeric characters, the lower byte contains the standard ASCII value where as the higher byte is empty (padded).

So when u say
TEXT1.TEXT = MSCOMM.INPUT
TEXT1.TEXT is unicode, and MSCOMM.INPUT is 1 byte. Maybe then the byte you read is placed into the high byte, with the lower byte empty, resulting in the erroneous higher value.

I don't know how this fits with Erik's solution though...maybe the first byte is discarded and the second byte completes the wide-character.

What you can do is use VB functions to convert the bytes from MSCOMM into unicode wide chars/strings. Try this...
TEXT1.TEXT = StrConv(MSCOMM.INPUT, vbUnicode)

Try the following link:
http://msdn.microsoft.com/library/d...topic1.asp

I have answered the same doubt in more detail sometime before on this forum. Please let me know if this works out, so even my doubt will be cleared and I can be more confident the next time I answer this doubt!! :-))

kundi

List of 11 messages in thread
TopicAuthorDate
serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      
RE: serial data format problem            01/01/70 00:00      

Back to Subject List