serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem)
serial port madness (maybe string problem) serial port madness (maybe string problem)
serial port madness (maybe string problem)
Go Back  Xtreme Visual Basic Talk > > > serial port madness (maybe string problem)


Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2009, 03:31 AM
picogsm's Avatar
picogsm picogsm is offline
Freshman
 
Join Date: Mar 2005
Location: Uk
Posts: 43
Default serial port madness (maybe string problem)


I am writing a software in two parts, one half in Atmel ATmega168 micro, second part in VB .NET Express 2008.

My initial code in the AVR simply turns an LED on when recieve 'a' and turns off when recieve 'b'.

I am using FTDI device for USB -> serial conversion.

When first powered on, the visual basic characetr is recieved by the atmel as garbage. For example I send character "a", the atmel sees it as ascii character 210 (not valid ascii).

However to test, I made a program with VB6 and mscomm. In three lines of code, I send value "a" and "b" and it works 100% first time, every time!

Now when I go back to VB .NET, this too works!

After power off, VB NET fails again, and need to send a character from vb6 first...

So seems vb6 string may be appended with something? where vb net is not?

in VB .NET i am using Trim(textbox1.text) on the sent data, in vb6 i can just send a text box with nothing more.

Any ideas on this weird problem?
Reply With Quote
  #2  
Old 05-18-2009, 05:40 AM
picogsm's Avatar
picogsm picogsm is offline
Freshman
 
Join Date: Mar 2005
Location: Uk
Posts: 43
Default

Problem solved!

Dispite reading countless times online that .NET strings are not terminated, it seems they actualy are!

Using port monitor software to spy comms, each vb .net string is terminated by 0x0D aka chr(13) aka vbCr

Using

Code:
dim s as string = (TextBox1.Text.Trim(Chr(13)))
Removes this little pest and now the string is sent exactly like VB 6.

Hope this may help another person!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem) serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem) serial port madness (maybe string problem)
serial port madness (maybe string problem)
serial port madness (maybe string problem)
 
serial port madness (maybe string problem)
serial port madness (maybe string problem)
 
-->