manual

WORD DOCUMENTS:
- kax 4/11/08 14:42 - Nowhere near complete. Still integrating all the bits. Doing my best to keep the numbering decent. NOTE the DOCX is the real file. The other one is included for luddites. Next update in 40 mins.

- kax 4/11/08 15:37 - Includes everything on this page. No good formatting yet. I'm going to email around a list of sections that are still empty.

System Overview
//Cassia talking scales// is a portable microprocessor-controlled scale designed to be used by the average consumer with ease of use for the visually impaired. It can be modified by the client to display in either grams or ounces with a weight limitation of 1kg load (1000grams, 35.2739 ounces) at any given time. All user interface is driven by a keypad list interface. Options are listed and results displayed on an LCD screen as well as spoken by the scales through the integrated speaker.

Document Overview
A short “road map” of the document, to provide an orientation for the reader. Summarise the purpose and contents of this document.

Reference Documents
The present document is prepared on the basis of the following reference documents, and should be read in conjunction with them. “PIC18F452 Data Sheet” “Winbond TTS Manual” “Altronics Keypad interpereter” "MM74C922 16 Key Encoder Datasheet " [|Encoder chip Datasheet] "ALTRONICS Z7000A LCD Module Datasheet" "Samsung KS0066U LCD Controller Datasheet" "Peer Ouwehand material on [|how to control HD44780-based displays]"

—. “CAN Specification 2.0”. Robert Bosch GmbH, Stuttgart, September 1991. —. “OMG Unified Modeling Language Specification”, vers.1.3, June 1999.

Acronyms and Abbreviations
Table 1-1 lists the acronyms and abbreviations used in this document. **Table 1-1: Acronyms and Abbreviations.**
 * **Acronym** || **Meaning** ||
 * ACFR || Australian Centre for Field Robotics ||
 * CTS || Continuous //or//  Continuously ||
 * PDL || Program Design Language ||
 * TBD || To Be Done, //also//  To Be Defined ||
 * <span style="color: rgb(255, 0, 0)">TLA || <span style="color: rgb(255, 0, 0)">Three Letter Acronym ||
 * <span style="color: rgb(255, 0, 0)">USYD || <span style="color: rgb(255, 0, 0)">The University of Sydney ||
 * <span style="color: rgb(255, 0, 0)">WTF || <span style="color: rgb(255, 0, 0)">What The Fork? ||
 * <span style="color: rgb(255, 0, 0)">TTS || <span style="color: rgb(255, 0, 0)">Text To Speech ||
 * <span style="color: rgb(255, 0, 0)">GG || <span style="color: rgb(255, 0, 0)">Good Game ||
 * <span style="color: rgb(255, 0, 0)">PIC || <span style="color: rgb(255, 0, 0)">PIC18F542 ||
 * LCD || Liquid Crystal Display ||
 * MPU || Microprocessor Unit ||
 * A/D || Analogue to Digital ||
 * ASCII || American Standard Code for Information Interchange ||

=System Description= This section is intended to give a general overview of the basis for the talking scale system design, of its division into hardware and software modules, and of its development and implementation.

Introduction
<span style="color: rgb(255, 0, 0)">Give a technical description of the function of the <span style="color: rgb(255, 0, 0)">//whole system// <span style="color: rgb(255, 0, 0)">, in terms of its constituent parts, here termed <span style="color: rgb(255, 0, 0)">//modules// <span style="color: rgb(255, 0, 0)">. Generally, a module will have hardware and software parts.

Voltage Measurement Module
<span style="color: rgb(0, 0, 0)">The scales hardware is a cantilever beam approximately 30cm long and 6cm wide. When masses are added to a pan on the end of the beam, the deformation of the beam is measured by 4 strain gauges located near the fixed end of the beam. The resistance of these sensors is measured, and then normalised to a 0-V++ range by an op-amp. <span style="color: rgb(0, 0, 0)">The voltage produced is measured by the A/D converter on the PIC (PORTA<1>), and recorded for further processing at a later time. The number saved is a 10-bit binary number, with 0 representing 0V, and 1024 representing V++ (negative voltages will be interpreted as 0V). V++ is generated by a variable voltage divider circuit. This can be manually adjusted using two trimpots (coarse and fine), to generate a voltage between 0 and 5V. By default this is set to 3.7V, allowing the full range of 0-1000g. If the scales hardware changed or needed to be adjusted, this enables an easy way to keep the system performing to specification.

Calibration and Voltage to Weight Conversion
Based upon a linear gradient and intercept that is set during the calibration mode, the function getWeight will look at the last voltage stored and convert it to a value of either grams or ounces (using a separate linear equation for the desired unit). Once converted, the N most recent values of mass are saved to a circular buffer, which is averaged and then converted into a string of characters to be displayed on Hyperterm or the LCD.

Calibration mode allows a technical user to adjust the accuracy of the scales. After entering factory mode, the user may enter calibration mode. The scales will record the voltage generated by the scales when there is no mass on it, and also when some non-zero mass is placed on the scales. Using the serial receive capability via hyperterm, the user is prompted to enter the known mass on the scales, which is interpreted as a number. These two datapoints are passed to the calibrate function, which will generate a new gradient and x-intercept that will be used for future weighings.

String Storage and Retrieval
There is a very limited amount of available RAM on the PIC, so most of the strings that are used by the text to speech, LCD display, and the serial transmission functions are stored in the FLASH memory until they are ready to be used. When a function wants to send one of these strings, they access it via the function "get_rom_string(unsigned rom char*)", which will fetch the sequence of characters via the TLATCH register, and then copy the string to a static location in local memory where other parts of the program can send it as if it were simply available in RAM. Since this location is shared by many functions, these values are copied to one of the output streams as soon as it is possible, because there is no guarantee that this temporay string will not have changed.

Operational Scenarios
<span style="color: rgb(255, 0, 0)">Describe how the system is to be used. There may be several different ways that it can be used, perhaps involving different users, or classes of user. Present use case diagrams here if you are using them. Each operational scenario is a part through a use case diagram – a way of using the system, with different outcomes or methods of use. <span style="color: rgb(255, 0, 0)">You should also consider the various failures that may occur, and the consequences of these failures.

System Requirements
The operational scenarios considered place certain requirements on the whole <span style="color: rgb(255, 0, 0)">something system, and on the modules that comprise it. <span style="color: rgb(255, 0, 0)">Statement of requirements that affect the system as a whole, and are not restricted to only a subset of its modules.

Module Design
<span style="color: rgb(255, 0, 0)">Describe the breakdown of the design into functional modules. Each module probably contains both software and hardware. <span style="color: rgb(255, 0, 0)">Then include a section like the following (2.5) for <span style="color: rgb(255, 0, 0)">//**each module**// <span style="color: rgb(255, 0, 0)">. Not all of the sub-headings may be relevant for each module.

MODULE DESIGN: TTS ---> kax 3/11/08 17:50 MODULE DESIGN: Serial RC --> kax 3/11/08 17:52 MODULE DESIGN : Keypad Module Design (Requirements and Conceptual Design): Serial transmit -Michael Conceptual Design: Variance calculation. (Not sure if this should be a module in itself, or part of a larger "weight" module) -Michael

Module design, Conceptual design, and Software design: Calibration: A/D Converter: -Duncan

LCD everything: - Michelle Stuff about the Scales hardware: [|Scales.doc] - Alex (Shout at me if anything is wrong).

Module Requirements: <span style="color: rgb(255, 0, 0)">Module X
The operational scenarios considered place certain requirements on the <span style="color: rgb(255, 0, 0)">something system, and on the modules that comprise it.

Functional Requirements
This section describes the functional requirements of<span style="color: rgb(255, 0, 0)"> Module X – those requirements that must be met if the module (and system) is to function correctly.

Inputs
<span style="color: rgb(255, 0, 0)">Describe each external input, including signal encoding and timing, message encoding and timing, protocols, file formats, protection against input errors, etc, as relevant.

Process
<span style="color: rgb(255, 0, 0)">Describe the internal signal transformations and/or computer processing functionality required within the module, required performance limits, and error tolerances as appropriate.

Outputs
<span style="color: rgb(255, 0, 0)">Describe outputs that must be produced for the module to function correctly, including timing, frequency, protocols, etc as relevant.

Timing
<span style="color: rgb(255, 0, 0)">Any required timing or latency specifications that must be met.

Failure modes
<span style="color: rgb(255, 0, 0)">Required functionality (if any) in the event of failure of various nominated components.

Non-Functional (Quality of Service) Requirements
<span style="color: rgb(255, 0, 0)">Non-functional requirements do not need to be met for the device to have basic function, but are required to provide specific levels of performance or engineering quality.

Performance
<span style="color: rgb(255, 0, 0)">Requirements such as computational loop time, accuracy, etc.

Interfaces
<span style="color: rgb(255, 0, 0)">Qualities that are desirable in input and output interfaces, but are not required for functionality.

Design Constraints
<span style="color: rgb(255, 0, 0)">Practical or commercial considerations, such as programming languages, processor or other hardware, etc.

Conceptual Design: <span style="color: rgb(255, 0, 0)">Module X
<span style="color: rgb(255, 0, 0)">Now, <span style="color: rgb(255, 0, 0)">//**for each module**// <span style="color: rgb(255, 0, 0)">, give the outline of how it will work. In this section it is appropriate to present > were designed the way they were <span style="color: rgb(255, 0, 0)">as appropriate for each module.
 * <span style="color: rgb(255, 0, 0)">The rationale for the design decisions that were made – <span style="color: rgb(255, 0, 0)">//why// <span style="color: rgb(255, 0, 0)"> things
 * <span style="color: rgb(255, 0, 0)">block diagrams,
 * <span style="color: rgb(255, 0, 0)">mathematical models and algorithms,
 * <span style="color: rgb(255, 0, 0)">data flow diagrams
 * <span style="color: rgb(255, 0, 0)">state-transition diagrams
 * <span style="color: rgb(255, 0, 0)">listings of input and output formats
 * <span style="color: rgb(255, 0, 0)">listings of message and data formats
 * <span style="color: rgb(255, 0, 0)">responses to identifiable error conditions
 * <span style="color: rgb(255, 0, 0)">responses to identifiable failure conditions

Assumptions Made
<span style="color: rgb(255, 0, 0)">State any assumptions made.

Constraints on Module X Performance
<span style="color: rgb(255, 0, 0)">State any constraints that may prevent the design from satisfying its requirements. = = <span style="font-size: 18pt; font-family: 'Arial','sans-serif'">User Interface Design <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">User interface is available from three states: local, factory and remote settings. Each state uses a different input setting and level of accessibility. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">The User Interface is based on a simple feedback structure where the user can go in and alter states such as base weight, measurement type (grams or ounces) and so forth according to their needs. Once input command is received, it changes structure and corresponding code to go with new input and will stay that way until the system is turned off or reset. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">The design of user interface is broken down in options that the user can choose from based on what state they are in. The code first checks the state the user is in. After this, it checks the function the user has chosen (such as weight, tare and so forth). Each function then corresponds to a different display and speech module. New functions are cross-referenced to previously received data and then displayed. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">The user is also given power over the speech module. As well as being able to choose state and setting, they have the added functionality of getting the system to repeat what was said (by pressing “speak” command on the keypad) or to mute (pressing “mute” command on keypad) the system. Pressing the speak button will overwrite the mute command. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Upon restart, the LCD module is cleared to display the menu back to the default setting (that is, local mode). <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 14.5pt; font-family: 'Arial','sans-serif'">Classes of User <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">User classes are defined by local, remote and factory settings. Remote and factory settings are displayed through the hyperterminal and uses a keyboard for interface whilst the local setting uses the keypad and LCD. Local and Remote settings contain mostly the same functionality whiles factory settings allows access to more sensitive calculation procedures such as calibration and statistics. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Changes between settings is done by the HyperTerminal. The system begins start up in the local mode. If the Hyperterminal is activated, keyboard controls can be used to switch between modes. Pressing ‘l’ will send to local mode, pressing ‘r’ will send to remote mode and pressing ‘f’ will send to factory mode. <span style="font-size: 14.5pt; font-family: 'Arial','sans-serif'"> <span style="font-size: 14.5pt; font-family: 'Arial','sans-serif'">Interface Design: <span style="color: rgb(33, 88, 104)">Local Setting <span style="font-size: 13pt; font-family: 'Arial','sans-serif'">**User Inputs and Outputs** <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">In local mode, the user interfaces with the system via the keypad and LCD. Options available can be seen in the following figure: <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">

<span style="color: rgb(79, 129, 189)"> Figure 1 Keypad option layout<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Weight: __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Pressing this key leads to a prompt on the LCD and from the TTS to load the first mass. The module calibrates this weight according the calibration settings (see factory mode) and outputs an answer to the LCD. The TTS also received this calibration and outputs through the speaker the weight output. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__Count:__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">In count mode, the first input will be to place a number of similar objects into the scale. A prompt will then take place to ask how many items are in the scales. Upon answering, the module calculates the mass of a single item. There is then a prompt for the second mode for the user to add items and calculates from previous measurements how many items are in this new mode. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">3.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Tare: __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Tare mode allows the user to set a zero reference point. This is primarily used for adding up weights. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">In this mode, the user is prompted to add weights into the system. After this, they chose to ‘tare’ the value. This resets the weight scale to zero. They can then add in more weights which value will be displayed in correspondence to the zero point set by the tare. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__4.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__Switch units__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Pressing this button switches between grams or ounces as a unit of measurement output. All measurements from this point on will be displayed according to the option set here. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__8. Mute__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Pressing this button deactivates the speak module <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">9. Speak __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Pressing this option repeats the last statement made by the TTS. This allows the user to rehear any instruction they may have missed. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">This button can also be pressed to deactivate the mute option. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">*. Back __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">This button allows the user to go back to the menu mode on the LCD <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__#. O.k.__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Pressing this button is received as a positive command. It is pressed when a task has been undertaken and the user is ready to continue. For example, it is pressed when the user is given the prompt to add a weight and they have finished adding the weight. <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">For the four main states, the LCD displays the state so that the user is made aware of what mode they are in.

**Input Validation and Error Trapping**
<span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">The LCD will express the state in validating the user input. Prompts from the TTS also verify the state due to the type of mode set (if not in mute). At times a key may need to be pressed twice to send to that mode. <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Operator errors are not caught in this part of the module. <span style="font-size: 12pt; font-family: 'Arial','sans-serif'"> <span style="font-size: 14.5pt; font-family: 'Arial','sans-serif'">Interface Design: <span style="color: rgb(33, 88, 104)">Remote and Factory Setting <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Here the user has four options. The fifth main option, calibrate, should not be used in this mode as it’s not programmed for display on the LCD. All options are available from user input on the keyboard. Options and results are displayed through the HyperTerminal. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">All options are activated by pressing their first letter (e.g for ‘weigh’ option, pressing ‘w’ on the keyboard activates this state.) <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">‘w’eigh: __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Weigh mode is the basic and most useful mode of the system. Upon entering this mode, the TTS and text prompts the user to place the weight they want measured onto the scale. It then calibrates this weight according the the calibration settings (see factory mode) and outputs an answer on the screen. The TTS also received this calibration and outputs through the speaker the weight output. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">‘c’ount: __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">In count mode, the first input will be to place a number of similar objects into the scale. A prompt will then take place to ask how many items are in the scales. Upon answering, the module calculates the mass of a single item. There is then a prompt dor the second mode for the user to add items and calculates from previous measurements how many items are in this new mode. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__‘t’are:__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Tare mode allows the user to set a zero reference point. This is very useful for adding up weights. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">In this mode, the user is prompted to add weights into the system. After this, they chose to ‘tare’ the value. This resets the weight scale to zero. They can then add in more weights which value will be displayed in correspondence to the zero point set by the tare. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Change ‘u’nits __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">This mode changes between using grams or ounces. By choosing this option, the user can now choose to switch between the two possibilities by following the prompts. All measurements from this point on will be displayed according to the option set here. <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">For all options, the user is made aware of what state they are in by a display in the HyperTerminal displaying the state before the result. Reading this line instantly conveys what mode is currently active. <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> <span style="font-size: 14.5pt; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Factory setting is similar to remote setting with inputs again from the keyboard. It has the same functionality as above with the additional system of ‘calibrate’, ‘statistics’, ‘raw’ and ‘samples’. These options are chosen by using uppercase letters. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">‘__C’alibrate__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">For the calibrate setting, the user is prompted to adjust the voltage output of the scales to a set weight. That is, to enter a known mass into the system. The user is then prompted to tell the machine the weight of this mass by typing the mass on the keyboard. By using the voltage output from the scales and adjusting to the input of what this output was stated to be, the program calibrates itself to use this ratio for all future measurements. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">‘S’tatistics __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Due to time limitations, this part of the module was not effectively completed. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">__‘R’aw__ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">This option displays the ‘raw’ weight. Choosing this option is the factory mode version of ‘weigh’ from remote. Please refer to “Remote setting: user inputs and outputs >> ‘w’eigh” for more information regarding this option. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> __<span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Sam‘P’les __ <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">This mode is similar to count mentioned in the other settings. Choosing this option allows the number of samples that contribute to a single weight estimate to be set. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Upon selecting this mode, the user is asked to set a couple of identical weights. Once this is done and entered, the user is prompted to type on the keyboard the number of units entered. The program then calculated the weight of a single unit. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">The user is then prompted to empty the contents and put a new load sample in. From this sample, this module calculates the number of contents in the scale based on the previous calculation. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'">Once again, for each option, the user is made aware of what state they are in by a display in the HyperTerminal displaying the state before the result. Reading this line instantly conveys what mode is currently active. <span style="font-size: 12pt; color: black; font-family: 'Arial','sans-serif'"> <span style="font-size: 13pt; font-family: 'Arial','sans-serif'"> <span style="font-size: 13pt; font-family: 'Arial','sans-serif'">**Input Validation and Error Trapping** <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">When a state is chosen, a fresh image on the HyperTerminal is generated with the state displayed and further options for the user to see. This tells the user if they have successfully chosen their new state. <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">If an incorrect option is chosen – that is, if a letter input is made that doesn’t correspond with a letter in the menu – then nothing happens. <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">If the operator chooses a wrong state, they can go back to the menu by resetting or going back by following the instructions displayed in the HyperTerminal. <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">The system is case sensitive. This is needed since have two ‘c’ operations: A lower case ‘c’ is used for the count option while uppercase ‘C’ chooses the calibration mode. It is up to the user to make sure they abide by this case sensitivity in order for the system to work correctly. They will be able to tell if an error is made by the HyperTerminal showing them the option they chose. = = = = =Hardware Design= <span style="color: rgb(255, 0, 0)">Give a detailed description of the design of hardware. The description should include mechanical drawings, location diagrams, electrical circuit schematics, circuit simulation or test results, PCB overlays, wiring diagrams, connector pin-out lists, pneumatic/hydraulic circuit diagrams,
 * //<span style="font-size: 13pt; font-family: 'Arial','sans-serif'">Remote Setting //<span style="font-size: 13pt; font-family: 'Arial','sans-serif'">: User Inputs and Outputs **
 * //<span style="font-size: 13pt; font-family: 'Arial','sans-serif'">Factory Setting //<span style="font-size: 13pt; font-family: 'Arial','sans-serif'">: User Inputs and Outputs **

Scope of the <span style="color: rgb(255, 0, 0)">Something System Hardware
<span style="color: rgb(255, 0, 0)">Statement of what is, and what is not, being designed and described here.

Hardware Design
(speech output hardware notes are included in the TTS document under module design)
 * Speech Output**


 * Low Pass Filter**




 * Pin Connections**




 * Keypad**



Power Supply
The hardware portion of this module consists of a power distribution board, which takes voltage from the power supply (in this case, the +5v and GND pins from the PIC board), and provides output to the other hardware. Each output is protected by a 47uF reservoir capacitor, which provides a buffer to the rest of the system if a single piece of hardware draws a surge of current. This is especially important because the PIC processor shares the same supply rails, and would reset if it lost power even for a short time. The software section of this module uses the low voltage detect interrupt capability of the PIC board. In the event that the voltage to the board drops below 3V, the system will inform the user that it is about to shut down, and attempt to save the calibration and tare settings to FLASH before it runs out of power.

Computer Design
<span style="color: rgb(255, 0, 0)">Description of computer hardware, including all interface circuitry to sensors, actuators, and I/O hardware.

Actuator Hardware
<span style="color: rgb(255, 0, 0)">As appropriate.

Hardware Quality Assurance
<span style="color: rgb(255, 0, 0)">Describe any measures that were taken to control (improve) hardware quality and reliability – Heartbeats, brownout conditioning/resets, reset conditions, testing and validation, etc.

Hardware Validation
<span style="color: rgb(0, 0, 0)">Each hardware component is tested separately using a digital multimeter and oscilloscope (as necessary) before it is integrated into the system as a whole. Due to the modular nature of the hardware design, individual components can be tested if they are suspected to be faulty and replaced individually.

Hardware Calibration Procedures
Most of the calibration issues are solvable using the software calibration procedure (above). However, in the event that the scales are not able to measure over the desired range of masses (0 - 1000g), the operational range can be extended by using the two trimpots on the Vref supply board. This will alter the maximum output voltage of the scales (which should not exceed 3.8V when 1000g is placed upon it), and allow the PIC to measure into this range. <span style="color: rgb(255, 0, 0)">

Hardware Maintenance and Adjustment
<span style="color: rgb(255, 0, 0)">Routine adjustment and maintenance procedures. For all the hardware within the project, there wasn't any heavy duty adjustment and maintenance that was required of the project. The issue that were faced in this area were:
 * issue of safely storing each individual component into the system box
 * each component had to carefully positioned to avoid any short circuiting or interference
 * protection from dust and particles
 * ventilation to prevent any overheating problems
 * using the multimeter to test connections to make sure each wire is properly crimped and ready to use

=Software Design= The software requirements and overview have been dealt with elsewhere in this document. The present section addresses the design and implementation of the software that forms the <span style="color: rgb(255, 0, 0)">X system.

Software Design Process
<span style="color: rgb(255, 0, 0)">How you went about designing the software – top down, bottom up, OOD, functional view, etc. From the beginning, an attempt was made to keep the design of the software layered - that is, the internal functions should behave identically, regardless of which input or output channels are being used. This was accomplished by using streams for both input and output. The reasoning behind this was that any input device (for example) could push instructions (as characters) to the input stream, and then interpreted as required by the rest of the program. The same was applied to the output: messages were streamed to output buffers, which could be transmitted/displayed/spoken at the appropriate rate.

The development of software was very much from the bottom up perspective. This approach was chosen to suit the needs of the team: each team member was expected to create very small, functional, robust blocks of code that could be used and reused to build the final product. Each team member was also required to document their code on a wikispace page, which would allow other team members to understand how to use their functions, and also provide a forum for peer review and criticism.

Integration was planned to start early, and be an iterative process instead of a single extensive build towards the end of the project. This was intended to allow early detection of potential problems, and also reveal shortcomings of the design that would need additional attention. However, the hardware integration was not synchronised with the software integration, and this meant that certain assumptions had to be made when putting together the software.

Software Development Environment
<span style="color: rgb(255, 0, 0)">The tools that were used, both software (compilers, assemblers, etc) and hardware (development boards, etc.).

Software development was done on the Microchip MPLAB Integrated Development Environment version 8.10 using the MPLAB C18 compiler (MCC18) version 3.21. See http://ww1.microchip.com/downloads/en/DeviceDoc/51519B.pdf for a user's guide to the MPLAB environment and http://ww1.microchip.com/downloads/en/DeviceDoc/C18_User_Guide_51288j.pdf for a user's guide to the C18 compiler.

A Microchip ICD2 in-circuit debugger was used in conjunction with a PICDEM 2 plus prototyping/development board for software debugging and hardware development. See http://ww1.microchip.com/downloads/en/DeviceDoc/51331C.pdf for a user's guide to the ICD 2 debugger and http://ww1.microchip.com/downloads/en/DeviceDoc/51275d.pdf for a user's guide to the PICDEM 2 plus board.

Software Implementation Stages and Test Plans
<span style="color: rgb(255, 0, 0)">Describe the way you went about implementing the software - staged implementation, pseudocode (PDL), unit testing procedures, integration testing, etc. Identify dependencies – e.g this had to be done before that, etc.

Software Quality Assurance
A free technical support hotline is available 24 hours a day, 7 days a week.<span style="color: rgb(0, 0, 0)"><span style="color: rgb(255, 0, 0)">

System Architecture
At a very high level, the system looks like this: Not everything is shown on this diagram (notably input methods). The overall architecture of the system is a layered design: That is, it takes inputs from the input layer (top), and passes them to the data processing layer (middle). The middle layer also includes a state machine, which will control how the information is presented to the output layer (bottom).

General Interfaces
Where possible, interfaces between layers were handled by buffers or streams. This allowed communication to happen asynchronously – ie, different parts of the program were free to execute at different rates, and not slow the entire system down. Generally, a circular buffer (of sufficient size for the task) was allocated, with one or more functions writing to it, and others reading from it.

In the cases where the buffer was likley to overflow/underrun, flags were used to communicate this to other modules sharing the stream, so that valuable information was not lost.

Error Checking and Handling
Given the extremley interconnected nature of the functions, it was important to make sure that each function performed it's task properly and was able to detect errors so that they were not propogated to the rest of the system. Where necessary, the inputs and outputs of a function were checked for correctness (eg: non-negative, non-zero, etc) and corrected/set to default 'safe' values if possible. During the debug and integration stage, functions were required to report these errors via the serial transmit function to alert the team.

Function size and Code reuse
There is a very limited amount of both program and data memory on the PIC so wherever possible, functions were written to be generalised and reusable. The result of this was that the program (except for the monolithic state machine function 'check_state') was built out of very small building blocks that could be easily debugged and rewritten as necessary.

Software Interface
<span style="color: rgb(255, 0, 0)">Describe the public interface of each software module.

Serial Transmit: Input = null-terminated ASCII string. No output returned to program.

Software Components
<span style="color: rgb(255, 0, 0)">This is a detailed view of the internal workings of each of the software modules.

Numerical User Input
For two modes: Count mode and Calibrate mode, the operational state of the input devices needs to change to allow numerical data to be received. This is accomplished by setting the global flag "num_input" to TRUE. This will change the way that key presses from the keypad are converted to characters on the input stream. For example, normally pressing the keys "1" and "4" would result in the characters "w" and "u" being placed on the input stream. However, if num_input = TRUE, then the numerical values of the keys will be placed on the stream. By keeping track of a pointer to the location on the input stream before the user began entering numbers, this string can then be null terminated by an OK/enter, and then sent to the function "atoi" to extract the value.

Count mode
Count mode is essentially an extension of weigh mode. A known number of objects are placed on the scales, and the user then tells the program how many are present. The average weight of each object is simply calculated by dividing the total weight by the number entered by the user. Then, the user is prompted to place an unknown number of identical objects on the scales. The software will then divide the total mass of the unknown items by the previously calculated weight of an individual item - yielding the number of items.


 * Serial transmit**


 * Variance calculation**


 * Keypad Interrupt and Input**



Preconditions for System Startup
<span style="color: rgb(255, 0, 0)">Describe any preconditions that must be satisfied before the system can be started.

Preconditions for System Shutdown
<span style="color: rgb(255, 0, 0)">Describe any preconditions that must be satisfied before the system can be stopped. =System Performance=

Performance Testing
<span style="color: rgb(255, 0, 0)">Give the results of testing conducted to determine the characteristics and performance of the system - memory usage, loop time, system accuracy, repeatability, ease of use, etc.

State of the System as Delivered
<span style="color: rgb(255, 0, 0)">A statement of your group’s opinion of the conformance of the system with the specification. After the system was demonstrated there were certain areas that needed to be addressed that involved the system’s conformation to the system specifications.

Firstly the system was able to measure the weight of the item in question to a respectable level however the system was at times slow and unresponsive to commands placed by the user on the feedback of the current weight. The TTS module will be temperamental during certain moments and won’t give a response and the system would need to be resettled to get it operational again.

The count function was unpredictable as well as the system will sometimes count correctly and other time it will count incorrectly however it will usually be off by a small margin, this could be due to software failure in the algorithm or there was an overflow of data.

Another specification requirement was for the system to be used by a blind person, which was made possible through the implementation of the TTS to talk during certain intervals in the menu options and via a quick access guide printed in Braille that tells the user which mode corresponds to each button on the keypad.

Other small areas which conform to the specifications: · Able to toggle between ounce and grams · Able to tare · Switch between factory and user mode

On the hardware level, the system conforms to the specifications as it was: · Light weighted · Low power · Circuits were integrated via the Vero boards

The system would have been portable as well however due to hardware faults, this was not possible as the smaller PIC board could not be implemented and the bigger one had to be implemented for demonstration.

Future Improvements
<span style="color: rgb(255, 0, 0)">Present a prioritised list of improvements to be made in future releases, giving reasons for the improvement and priority rank.

<span style="font-size: 18pt; font-family: 'Arial','sans-serif'">Safety Implications <span style="font-size: 12pt; font-family: 'Arial','sans-serif'">According to the //NSW Occupational Health and Safety Act 2000//; //NSW Occupational Health and Safety// //Regulation 2001// the following guidelines must be kept in order to maintain user safety. Team Cassia does not take any responsibility if misuse of the product as outlined here leads to damage to person(s) or to the environment. <span style="font-size: 12pt; color: red; font-family: 'Arial','sans-serif'"> ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Do not get the product wet <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">It may resemble a fish tank however the electronics inside the containment unit are very sensitive and any water may and will lead to decreased functionality, short circuiting and possible harm to the user ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Keep the product out of reach of children at all times <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">This is not a toy. The casing can break creating sharp edges that young children may hurt themselves on. Also poking fingers through the gaps or opening the side containment can lead to electric shock. ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">The product should be placed in a flat dry space, well ventilated from moisture in order to maintain ideal working conditions. ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Do not remove or alter the electronics <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Team Cassia takes no responsibility for any damage to the product that takes place due to altering the circuitry. If you believe there is a hardware problem, please call our helpline and we will send someone to fix the problem or replace the unit for you. Under no circumstance should the user attempt to fix the problem themselves for their own safety. ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">The unit should remain closed in order to ensure all electronics are safely tucked inside away from the outer environment where they may cause harm. The self contained unit is a protective and non conducting material so as long as no one attempts to open the unit, it should remain safe for the user. ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">In case of electric shock: o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Do not attempt to touch the user o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Make sure you have adequate grounding (such as rubber soles on you feet so that you too do not become a conducting source) o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">With a non conducting material (such as a wooden ruler), switch off the power at the source to shut down the voltage path. o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">With a non-conductive material attempt to move the user out of the current path o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Call an ambulance if the user appears harmed in any way from the experience ·<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">In case of electrical fire: o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">DO NOT USE WATER TO PUT OUT THE ELECTRICAL FIRE o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Open all windows and doors in order to ventilate the smoke – the gas is poisonous o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">If fire starts at the wall outlet, pull out the plug by the cord or turn off power at the main switch o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">Call the fire department giving them all details and telling them it’s an electric fire o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">If a CO2 extinguisher is available, use this to attempt to put out the fire (if the fire is small) o<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal"> <span style="font-size: 12pt; color: black; line-height: 115%; font-family: 'Arial','sans-serif'">If the fire becomes uncontrollable, evacuate anyone in the building and await for the fire department to arrive.

=Conclusions=

<span style="color: rgb(255, 0, 0)">Appendices are used for any material that is not included in the main part of the report, usually because it would be distracting to the reader.
 * Appendix A:** <span style="color: rgb(255, 0, 0)">**Title**
 * A.1.** <span style="color: rgb(255, 0, 0)">**Subtitle**

<span style="color: rgb(255, 0, 0)">You would normally include <span style="color: rgb(255, 0, 0)">**manufacturer’s data sheets** <span style="color: rgb(255, 0, 0)">, but please do NOT include them in this report.

<span style="color: rgb(255, 0, 0)">**Supporting calculations** <span style="color: rgb(255, 0, 0)"> should also go in an appendix.

<span style="color: rgb(255, 0, 0)">If you use <span style="color: rgb(255, 0, 0)">**Doxygen** <span style="color: rgb(255, 0, 0)"> (www.doxygen.org) for code documentation, generate rich text format (RTF) output, open the RTF in Word, copy, and paste it into an appendix.

<span style="color: rgb(255, 0, 0)">Please do place your <span style="color: rgb(255, 0, 0)">**code listings** <span style="color: rgb(255, 0, 0)"> in the following 2-column section. Make sure to use a non-proportional (mono-spaced, or “typewriter”) font, such as <span style="color: rgb(255, 0, 0)"><span style="font-family: Courier New,monospace">Courier New <span style="color: rgb(255, 0, 0)">or <span style="color: rgb(255, 0, 0)"><span style="font-family: Andale Mono,MS Gothic,monospace">Andale Mono  <span style="color: rgb(255, 0, 0)">.

<span style="color: rgb(255, 0, 0)"><span style="font-family: Courier New,monospace">Place code listings here, using style “Code Appendix” The column width will fit approximately 88 characters per column.

<span style="color: rgb(255, 0, 0)"><span style="font-family: Courier New,monospace">Each file should start on a new page, or at least at the top of a new column.