View previous topic :: View next topic |
Author |
Message |
Guest
|
RS232 and VB |
Posted: Wed May 03, 2006 1:40 pm |
|
|
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
|
|
Posted: Wed May 03, 2006 1:45 pm |
|
|
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
|
|
Posted: Wed May 03, 2006 3:14 pm |
|
|
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 |
|
|
|