CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RS232 and VB

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








RS232 and VB
PostPosted: Wed May 03, 2006 1:40 pm     Reply with quote

Hello,
I know this is a CCS forum but maybe someone has had the same issues i am having.
I am reading rs232 in my vb program and the data is being read into a text/label. The problem is that along with the data it also displays squares to the left and to the right. It seems that when the buffer is read with mscomm1.input it does not know where the end of the text is. I read trhu literature and see there is a EOF enable that might be used. where would i implement this EOF within my PICs printf statement if this is the route to take or is there something else i am not seeing. My printf satement is printf("%lu\n\r",data2);.
Any help would greatly appreciated!

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 03, 2006 1:45 pm     Reply with quote

It appears that you want to trim leading and trailing spaces from your
text string. Basic has functions to do this. You should search Google
for this search string: visual basic trim strings
The 2nd hit takes you to a page with many links for string handling
examples.
Ttelmah
Guest







PostPosted: Wed May 03, 2006 3:14 pm     Reply with quote

The squares, are the ASCII 'text' representation of the new line/carriage return characters. You receive _all_ the data (including the new line, and the carriage return). There are (many) better 'comm' controls, including ones that will wait for the CR/LF, before returning the data, however you can do the same very easily. If you look a the 'help' file in VB, and how it waits for the 'vbCRLF', to arrive. you can perform a similar operation and wait for these characters. Then strip the characters as PCMprogrammer says.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group