Hello,

My name is Gordon Hope. I am not a professional software engineer but do have software background by training in college and from projects I have taken on myself from home. I have been around programming since 1969 when an IBM 1401 with 48KB of core was a huge system and cost over $1M.

I am currently working on a project in VB.NET which is in the support of one of my hobbies in model trains. I am using an RS485 network of I/O cards that each support a lot of inputs and outputs designed to keep track of train location, control of switches and lights and feedback from switches as to their position. A lot of the hobbyist level application code for the network cards is legacy VB6 and legacy Quickbasic code. Whereas this works fine for most, since I had not yet invested in that software for low level routines, I am undertaking a rewrite in VB.NET. I do get some help from real engineers at work as to professional software approaches for communications but decided to reach out to this community as an additional wealth of possible information and guidance if and when I need it.

I enjoy learning the right way to do things and will tackle the problem with a zealousness to learn along the way. The ultimate goal of this undertaking is to get total automatic program control of various trains running on a railroad to schedules and also to be able to interact with the trains by adding a train of my choosing for manual control.

Yeah most existing code for applications like model trains is in vb6 or very old nonstandard C like Borland Turbo C.

VB/NET is a pretty nice language, i use it for developing apps for mobile devices like PDAs

Welcome to daniweb and I wish you the best of luck here!

J,

Yes, what you say is true. Much of the code is written from a communications standpoint in simplistic and intentionally hobbyist way such that the average skilled software dabbler could run with the code and the network cards and make things work relatively easily.

I (along with help of engineers at work) re-wrote the fundamental low level communication routines in VB.NET (VB8 edition) to provide a true asynchronous send/receive routine whereby characters come through a DataReceived event of a SerialPort object and processed there. The code that is supplied is very primitive and goes into a wait state once a Poll for a network card has been sent. Right now, all the routines are working quite nicely but I need to go one final step in these routines and create a thread in my DataReceived routine to trigger the calling routine that a message has properly been received before I send the next Poll to the next board in the network. Unfortunatley this limitation is mandated as the network hardware does not have any capability to provide software control on the RS485 bus to sense it being busy and wait. They designed it such that when a Poll is sent, the card addressed blindly and immediately sends results back. So although I have written an enhanced asyncrhonous send/receive routine, I am being told by my engineering team at work that a good way to finalize the code is to add a "thread" which would trigger my calling code when an input message was completed. This way, I could then move to the subsequent board and Poll it.

At this point, all of my VB.NET books are not covering the way to create a thread so I am looking and talking to people at work to finalize this one aspect so I can complete my low level comm routine.

I must admit I am having a ton of fun doing this - lot of work, but a great education. :-)

At some point in time, the reason I liked going to .NET to begin with is the eventual power of being able to get to web connectivity and maybe even PDA control, even remotely! :-)

A lot to learn though, one step at a time - start with Windpows app, get it solid, and go from there.

Gordon

only time i have ever personally had experience with threading in vb.net was when i looked at the code for a peer to peer instant messaging program using winsock. It used threading to the program could send and listen at once.