Items get into the Projects category if I deem them to demonstrate an important concept of some kind. I will try to explain what concept
each of the following demonstrates as part of it's bullet listing.
- COMDIO - Using the Com Port Hardware Handshake Pins for Digital I/O. Most computers have at least one
COM: port and usually COM1: and COM2: are both available, even on most industrial laptops. The DO pins can be used to assert triggers to
an oscilloscope and you can determine the elapsed time between events for diagnostic reasons, for instance. Also, you might find that you
occasionally need DIOs to implement an interlock circuit, etc. This code makes 2 DIs and 2 DOs per COM: port available for free.
- Date/Time - Date and Time Functions including Conversion from Local Time to UTC and Back. These
functions use a combination of the Gregorian Day Index and the
Julian Date to rapidly handle time and date calculations and timestamps to 1 millisecond
accuracy. There are many time calculations that are accurate to one second but when you get into some of the
IRIG Time Standards you need accuracies to 1 ms and beyond.
This code allows this.
- Dates - Several years ago I had a supervisor who would ask me how long something would take.
I would say something like "4 man weeks" and a month later he would say "How come you are not done?" even though
there was a holiday and 2 weeks vacation in between. While this is a trivial app, it helped me assign more accurate dates for completion
so I felt that others might be able to benefit from it as well. It is also another example of how to use the Date/Time functions to
- Depend - It historically determine External Dependancies for Single Pass Linking. While this code is no
longer very useful for its original purpose but it was reimplemented in the 64-bit file system functions and includes a binary table lookup
for fast record access in VERY large files (the records have to be equal size and the file has to be in sorted order).
- Factors - Compute the Prime Factors of an unsigned 64 bit number from 1 to 18,446,744,073,709,551,615
(i.e. 18.447 Quintillion). While these numbers are not long enough to be cryptographically important, it will give you an idea of the
complexity of trying to factor large numbers. For real world problems, you can sometimes simplify equations by canceling prime factors.
It can also help you to solve your kids school math problems.
- Mail - MAPI Mail without MFC. Thi code was written to allow programs to e-mail information about events
and/or to contact someone's cell phone with a text message. Microsoft has rendered this code less useful with their "security fixes"
but you can still get it to work if you are using exchange server. I hope to eventually fix this by fully implementing a pop3 version
that bypasses MAPI entirely. This code is still useful for implementing "Send To" commands where you don't mind the intervening interactions.
- Math - Various Math Routines:
- Round - Round a Double Precision Floating Point Value to the Specified Number of Decimal Places.
Users sometimes get hung up when the math doesn't match exactly. This often happens when the user uses displayed values and tries
to match computations that use the full precision floating point numbers. When you can round the number to the number of displayed
digits, the calculations become magically more accurate.
- Ping - Programatically "ping" a network component. It is nice to check that all of the required
network components are alive and online before starting an action, especially if you know that it will fail otherwise. Using the
ICMP Ping protocol is a fast way to determine this. And, it is a good way to recognize that the network is down, rather than that
a piece of code has failed on the remote system (if you can't talk to the device but you can ping it, the remote software has failed,
but if you can ping it, the remote computer or the network is probably down).
- Random - Random Number Generator from Makoto Matsumoto and Takuji Nishimura. A good
Random Number Generator is not always provided in the libraries of small embedded systems. This one, from Makoto Matsumoto and
Takuji Nishimura, seems to work pretty well and is not terribly consumptive of resources. As an example of where a random number generator
can be useful, cryptographic systems often use a nonce initialization vector and Cipher-block chaining to assure that data will
vary randomly, even if the raw data is the same (i.e. a block of zeros for uninitialized data). This makes it that much harder
to decode the encryption key
- RemStart - Remotely Starting a Windows System Service. RemStart illustrates how to remotely
start a Windows System Service via a network connection. This allows you to set the service for "Manual" startup so that doesn't
use system resources (CPU cycles, memory, etc.) until you need them Programmatically, It also assures that the remote System Service
is up and active before you try to access it.
- Sunrise - Compute the times of Sunrise, Solar Noon and Sunset. This allows solar control systems
to discontinue recording data when the system is inactive. You might want to start your data acquisition system 15 or so minutes
before sunrise and stop it 15 minutes after sunset so that you capture all of the pertinent enviroinmental and control information.
- Threads - Programming with Threads. This project demonstrates how to programatically set up a
multi-thread system, including how to post messages to the thread message queue to communicate with the thread and how to correctly
close all of the thread resources and shut down the system.
- TrySvc - Trial System Service. TrySvc documents the creation of a Windows System Service.
System Services normally run at the System level and therefore have access to virtually everything in the system. They boot
with the operating system and don't require that a user be logged in to execute. They can even be set to manual start and be controlled
by the RemStart code shown above. You can use the Ping code to verify
that the remote system is alive and well before starting the service.
- WebPage - Programatically Accessing a WebPage. WebPage illustrates how to programmatically
acquire a web page. Several current pieces of equipment give access to status and other information, via embedded webpages.
Several vendors of embedded controllers, including
Rabbit Semiconductor and
NetBurner supply HTTP libraries with their systems
in order to make web pages viable user interfaces. For instance, my Brother HL2070N Networked Laser Printer and my
Motorola 3347 DSL Modem both have web page interfaces. This may be the only networked interface available for the instrument so
WebPage provides a viable means of accessing (and sometimes controlling) the instrument in spite of that.
Last updated: Sunday, September 11, 2011