How Plot Itbs Works

The first instruction in the Plot_It routine computes the checksum of the four A/D voltage values. The second instruction uses the DEBUG command to transmit the four voltage values followed by checkSum to the PC via the COM port. The third instruction pauses our program for 250 ms (one fourth of a second) to allow StampPlot to plot the data. Finally, the program clears all these variables as a matter of proper cleanup, by setting ch0 through ch3 and checkSum equal to zero before returning to the Main calling routine (piot_it_End). Notice the use of comments to the right of some of the instructions. These comments explain what the code is doing and, also, act as memory joggers for future reference.

Now here's a little more explanation about computing checksums. Since each ch0 through ch3 variable can hold a value between 0 and 255, adding all four values together may cause the checksum variable to overflow, leaving only a partial result. This is perfectly okay since the StampPlot software will also compute its own checksum in the same way. If our checksum matches with StampPlot's computed checksum, StampPlot will graph the ch0 through ch3 values. Otherwise, it will flag an error and not plot anything.

V Now make sure you have saved your program, then close the BASIC Stamp Editor.

DIY Battery Repair

DIY Battery Repair

You can now recondition your old batteries at home and bring them back to 100 percent of their working condition. This guide will enable you to revive All NiCd batteries regardless of brand and battery volt. It will give you the required information on how to re-energize and revive your NiCd batteries through the RVD process, charging method and charging guidelines.

Get My Free Ebook


Post a comment