home
Software Design
While the software for VP·SQUARED can only be truly understood by the original developers (or the clinically insane), we can attempt to convey our intentions and, at the very least, can describe the various functional blocks our code contains.

Programmed in CodeVisionAVR C (version 1.0.1.5d), our software has undergone quite a transformation. While initially just a blank page, it has evolved into a simple stepper motor test program, then to manual vertical line drawing, to automated point-by-point plotting and beyond. In its most current incarnation it includes 11 states, and state changes occur every 30 milliseconds. The states include GET X, GET Y, PLOTTING, POINT COUNT, CALIBRATE, TOP MENU, RESOLUTION, GET DEGREE, GET COEFFICIENT, GET BOUNDS, and DISCRETIZE. The flow amongst these states is outlined in the state diagram found at the bottom of the page (Figure 6), and in the following discussion:

TOP MENU
This is the entry point for the user. TOP MENU Provides functionality for calibrating the plotter, changing the step size (resolution) and plotting a user defined number of points. Provides entry into CALIBRATE, POINT COUNT, and STEP SIZE.

STEP SIZE
Changes dx resolution based on users' fancy. Ultimately effects how smooth or jagged the plotted line looks. A lower resolution will require fewer calculations, but it will be a worse approximation to the actual desired shapes. When done returns to TOP MENU.

POINT COUNT
Allows the user to enter the desired number of discrete points they want to plot, then procedes to GET X to allow them to input the points.

GET X
Allows the user to enter the x-coordinates of their desired point. This function gets called repeatedly depending on how many points the user entered, each time formatting the input and storing it into the x_coord array. When a value is entered and the "done" (D) key is hit, it moves on to GET Y.

GET Y
Allows user to enter the y-coordinate of their desired point. Like GET X, this function gets called repeatedly depending on how many points the user entered, each time formatting the input and storing it into the y_coord array. When a y value is entered, and there are no more points to enter, it goes on to PLOTTING, otherwise it goes back to GET X to get more points.

CALIBRATE
Allows the user to manually control each of the stepper motors individually, or at the same time via tbe numbers 1, 2, 4, & 5 on the keypad. Presumably, the user will use this feature to place the cursor at the correct starting point to ensure proper output, but it can also be used as an etch-a-sketch type mode where the user can plot anything, limited only by their own dexterity. When done calibrating, return to TOP MENU.

PLOTTING
Takes values from the x and y coordinate arrays and negotiates how to step the left and right motors for each set of coordinates. When it completes one set of coordinates, it pauses, then gets a new set and repeates the process. When there are no more coordinates to plot, it returns to the TOP MENU.

GET DEGREE*
GET COEFFICIENT*
GET BOUNDS*
DISCRETIZE*

Figure 6: Software State Diagram

 



* These states have not been fully debugged, so they are not available to the user at this time.