|
VB, C#, ASP.NET, Pocket PC, & CE.NET for Industrial, Laboratory, & Manufacturing AutomationExample Programs
Sorry if things look a little out of sync around here. There are a lot of improvements going on. We finally changed web hosts to a Windows based server with FrontPage 2002 extensions and .NET -- so that you can run the ASP.NET versions of the applications on-line. Needless to say, running ASP.NET on our local servers is much easier than getting everything set-up on a web host. Bear with us while we try to get all the problems worked out with our web host. In the meantime, you can still download the source code, compile (build) it, and run it -- you just can't run it on-line. We are upgrading all of our sample code to VB.NET and C# and will keep the VB6 code for people that have not migrated yet. Another reason for having the VB6, VB.NET, and C# code available is to help people learning .NET to see the changes. For you lite fans, we are also adding code for PocketPC and CE.NET. Using all of these versions will definitely effect our programming guidelines to try to stay compatible across all platforms.
What are we trying to do and how best to do it?There are three primary functions the software we write performs: control, monitoring, and distribution of information. Note that we don't advocate using ASP.NET for control. Depending upon the application -- ASP.NET is probably not the best solution for monitoring either. For distribution of information -- if you want a web based configuration -- then ASP.NET is definitely a good choice. We still prefer VB.NET or C# for control and monitoring. We like VB.NET or C# for distribution of information also. We like the capabilities of a VB.NET or C# rich / fat / intelligent client instead of a poor / lean / dumb browser. There is a lot of overhead involved with ASP.NET and getting real-time, consistent response time is a challenge. However, as a reporting tool of process data -- ASP.NET definitely make sense. The main reason we are showing ASP.NET here is so that you can see the examples without having to download the code, unzip it, load it into Visual Studio, build the solution, and then run it. Using ASP.NET -- you should be able to run the examples on-line.
Commenting ConventionsCoding conventions (standards) are a great thing to have so that every piece of code looks familiar. To some extent every company has their own coding standards. For example, we are not big on having a huge block of comments at the start of every function that tell you what the function name and passed variable names already tell you. But some other companies still insist on this. This practice started many years ago when function and variable names were limited to eight characters and therefore usually cryptic. We prefer "self documenting code" and save comments for information that is not obvious. For example: Public Sub SendCommandToRobot(byval strRobotCommand as string) You could waste a lot of time and space writing comments that:
But none of these comments would tell another programmer anything new -- in other words, we are wasting everyone's time by writing comments that tell you the same thing as what was "self documented". A comment that would be important here is something like: ' This subroutine enters robot commands into a queue of commands going to the robot in which case, we probably should have named our subroutine "PutRobotCommandIntoQueue".
Coding ConventionsNote that when you receive VB 6 they hit you over the head with coding conventions. Coding conventions are an excellent idea. Hopefully, all of our VB6 example code follows our published VB6 coding conventions (do as we say -- not as we do). Many of the VB.NET and C# books are good as far as teaching the language -- but their coding conventions range from inconsistent to terrible! In a rush to get the first books out, most of the books were written several years ago with only the beta versions of .NET and little support. So it was a lot tougher then. For VB.NET and C# we are adopting the coding standards from GotDotNet's FxCop and Microsoft's .NET Framework Design Guidelines. Surprise, surprise. Most of the coding conventions that we had been using are out the window. So please excuse us until we get around to using the coding conventions. We don't want to discourage using the new coding conventions. It's just that after writing hundreds of programs and hundreds of thousands of lines of code with other conventions -- it takes a while to convert. However, we are grateful for GotDotNet's FxCop program that greatly facilitates that transition. We found one other link for VB.NET coding standards.
Download OptionsThere are several versions of each example program:
Support on Message Board / Discussion GroupWe want to share all of our knowledge and source code in order to stimulate ideas and discussions and make everyone a better automation programmer. We hope that you will share your knowledge and source code as well. But we can't stay in business by spending all of our time helping people for free. (This "free" business model was tested by many dot com companies and we saw how well that turned out). Therefore, we set up a message board (discussion group) so that you can post questions and we or others can answer those questions. Please click on the "Message Board" button in the left column. Hopefully the message board will foster more discussions and examples.
Source Code User Assumptions
Example 1Test to make sure you have a basic understanding of VB / C#. We're not trying to be mean -- but this is not an introduction to VB / C#. There are many other great websites that cater to beginning VB and C# programmers -- so we will not duplicate that here. If you are a beginner we suggest you go to our books page. This website is for intermediate to advanced users of Visual Basic C# for automation. We assume that you already have a good understanding of programming in VB or C#. If you can not throw buttons and text boxes on a form and tie them together without having to think, then most likely you will not be able to understand writing reports to Excel using objects or loading recipes using ADO. However, if you are a persistent and smart beginner then you can probably go through advanced topics, compare them to other information and learn a lot. If you are a beginner may we suggest that you still go through and view the example programs so that you get an overview of what VB / C# can do.
Example 2Displaying status of automation devices.
Example 3Congratulations on your first job as material handling manager and your first material handling sortation project.
Example 4Selecting file names.
Example 5A Tale of Two Timers -- beware of the problems presented here.
Excel ExamplesReading and writing to Excel
ADO ExamplesADO -- reading and writing databases for configuration data, recipes, and other data.
Waste Water Treatment ExampleCongratulations on your new job as plant manager at the waster water (sewage) treatment plant.
Serial Communications ExamplesRS232, RS422, RS485
Ethernet and WinsockTCP/IP, client / server, windows sockets over Ethernet
HTS PDA ToolsBased on our reference data, HTS PDA Tools is a collection of our favorite calculators and tools for Pocket PC devices.
We try to offer a fair and balanced opinion on every page of our website. We would appreciate more information from other users to express their opinions which we will then incorporate. If you have questions or comments please post them on our message board (see button in left hand column) so that others can read and benefit.
|
|
Click here to find out how High Tech Services can help you implement this technology. Copyright © 1984-2005 CompanyLongName HTS, Cary, Raleigh, RTP, North Carolina, NC. All Rights Reserved. All trademarks are the property of their owners. Prices and specifications subject to change without notice. |