Download sensor acquisition and control system
Transcript
each port on the UBW, a 0-set bit indicating an output and a 1-set bit indicating an input. This number then is converted to a decimal number and passed as the port a, b, and c pin directions. The analog pin initialization is complex to understand, but basically consists of an 8-bit binary number where a pin is specified as analog by being set to a 1. The stipulation to this is that all pins under the highest pin selected as analog must also be analog. Not adhering to this rule will simply cause the analog equivalent of the digital value of the pin’s current output voltage to be presented as the only value on that pin. This could be used as a desired effect, but is otherwise rather useless, and is simply a limitation to the current firmware structure of the UBW. Version The version command is used to send back the firmware coded version string. This string is beneficial in identifying application specific UBW devices, and is used in the port question method for identification of the UBW’s COM port. This method requires no input parameters, and returns a string containing the firmware coded version. Reset Resets all pins and ports to default values. This eliminates any previous configuration that was operating on the UBW. This method requires no input and provides no output beyond the command response to identify successful command execution. Timed Sample This command allows for a single call to the UBW device to return streaming samples from the analog ports. This runs equivalent to the Analog Sample command on the UBW, but returns based upon a millisecond resolution and an I/O direction. The resolution is currently limited to one sample every ten milliseconds, or equivalently 100 samples per second. On the UBW firmware side, the benefit of this method of analog input reading is that it eliminates successive calls to the UBW, effectively reducing USB bandwidth usage by half. 26