The main functions for the software are to:
1) Give conversion commands and read data from the ADC
2) Increment and reset the counter to select the correct channel
3) Record the samples to a disk file
4) Plot the samples on to a graph
5) Upon user request, retrieve samples from the file and display them at the required intervals of time
6) Provide a simple user interface
The program was written in C++. The program uses Simple DirectMedia Layer (SDL), an open source cross platform multimedia library to create the graphics, threads and user interface. To draw basic shapes like lines, circles, text etc., another library SDL_gfxPrimitives was used. Kindly refer to the appendix for more information about them.
The user interface was written from scratch. The following files and their descriptions are given:
1) Widget.h+Widget.cpp: Basic functions common to all UI elements.
2) Button.h+Button.cpp: To create a button and its associated functionality.
3) ComboBox.h+ComboBox.cpp: To create a drop down combo-box for making selections and its associated functionality.
4) Menu.h+Menu.cpp: To create a pull down menu for the application and its associated functionality.
5) Graph.h+Graph.cpp: To create a single graph and plot it.
6) MultiGraph.h+MultiGraph.cpp: To create a mixed graph with several graphs within it, which can be displayed in a number of ways.
7) InfoDisp.h+InfoDisp.cpp: To display textual information in an organized way.
8) MessageBox.h+MessageBox.cpp: To create dialog boxes.
9) SDLWrap.h+SDLWrap.cpp: A wrapper class for the SDL library. It manages the screen and provides a simpler and concise way of accessing the SDL library routines.
It makes use of the SDL and SDL_gfxPrimitives libraries.
The parallel port access was accomplished under Windoz 98/NT/2000/XP by using the parallel port driver Inpout32. For details, refer to the appendix.
The main program performs the following functions:
1) Asks the user to enable or disable channels.
2) Creates a thread for sampling
3) Creates the menu and graphs
4) Waits for user input and refreshes the menus and graphs
The sampling thread works as follows:
1) Selects the channel for sampling.
2) Gives start of conversion command to ADC.
3) Waits for the end of conversion signal.
4) Reads in the data from the ADC.
5) Puts the data into the queues for file and graph.
6) Switches to the next channel and repeats.
7) Once all the channels have been sampled, waits for the second to pass, and repeats the whole process.
8) If a termination signal is received from the UI, the thread is terminated after the current sampling cycle.
NOTE: Refer to the project website for the latest updates.
The complete source code will be put up very soon.