Design Project



Homework 10: Software Design Considerations

Due: Friday, February 9, at NOON

Team Code Name: _________BatteryMax_________________________ Group No. __8__

Team Member Completing This Homework: _____Jay Doyle_________________________

e-mail Address of Team Member: _____jsdoyle_________ @ purdue.edu

[pic]

Evaluation:

|Component/Criterion |Score |Multiplier |Points |

|Introduction & Summary |0 1 2 3 4 5 6 7 8 9 10 |X 1 | |

|Software Design Considerations |0 1 2 3 4 5 6 7 8 9 10 |X 3 | |

|Software Design Narrative |0 1 2 3 4 5 6 7 8 9 10 |X 3 | |

|List of References |0 1 2 3 4 5 6 7 8 9 10 |X 1 | |

|Appendices |0 1 2 3 4 5 6 7 8 9 10 |X 1 | |

|Technical Writing Style |0 1 2 3 4 5 6 7 8 9 10 |X 1 | |

| |TOTAL | |

Comments:

Comments from the grader will be inserted here.

1. Introduction

The demand for batteries in our techno-centric world is huge. From laptops, hand-held GPS devices, to even portable defibrillators, batteries are everywhere. With this great amount of power hungry, portable devices comes a huge need for batteries. Of course, not all batteries are created equal, they come in a variety of sizes and technologies to fit every niche the battery market needs filled. For this reason, we are creating a universal battery charger – the BatteryMax – capable of recharging just about any type of rechargeable battery.

To make a universal battery charger function properly, many things must be considered, not the least of which is the software that is in essence the lifeblood of the device. The software is what allows the device to function. The charging profiles which charge the battery are only a small part of the total software package put together for this project. The external interfaces (LCD, keypad, RJ-45) will also require software to function properly and provide an interface between the battery charger and the user.

2. Software Design Considerations

The Motorola MC9S12NE64 contains an on-chip 8KB SRAM and 64KB flash memory [1]. Because of the volatility of the SRAM, the program must reside in the 64KB flash module. This leaves the SRAM free for program variables and the stack. According to the MC9S12NE64 datasheet, the memory mapping for the SRAM is $0400 through $1FFF [1]. Accordingly, the address for the start of program’s RAM will be mapped to $0400 while the stack pointer will be mapped to address $2000. (Remember, when something is pushed onto the stack that the address is decremented before information is stored, therefore the first address used by the stack will be $1FFF.) The program itself will be stored in the on-chip flash. This is nonvolatile memory, meaning it will retain the executable code after power is disconnected from the chip. Please see Appendix C for graphical mapping of the MC9S12NE64’s address space [1].

|Addresses |Module |Device |

|$0080 – $009F |Analog to Digital Converter (ATD0) |Battery Voltage Sensor |

|$0080 – $009F |Analog to Digital Converter (ATD1) |Battery Current Sensor |

|$0080 – $009F |Analog to Digital Converter (ATD2) |Battery Temp. Sensor |

|$00C8 – $00CF |Serial Communications Interface (SCI0) |16x2 LCD Display |

|$00D8 - $00DF |Serial Peripheral Interface (SPI) |Digital Potentiometer |

|$0120 – $0123 |Ethernet Physical Interface (EPHY) |Ethernet Adapter |

Table 2.1 Mapping of External Interfaces [1]

The main program loop will be organized in a continuous polling fashion. None of the external devices need interrupt driven polling, nor do they have any specific timing parameters. Additionally, the enclosure will have a full time fan, so heat is not a concern. Therefore a continuous polling loop is acceptable in this situation. The loop will check the status of the battery monitoring devices (voltage, current and temperature) to ensure the battery is still charging normally; within the charging profile for that specific battery type. If it is not operating properly, a service routine will handle the irregularity by making changes to the DC-DC converter and updating the LCD and web-based information outputs. The loop will also check the status of the three input devices (LCD panel buttons, the keypad and the RJ-45 port) to handle any user input. If any of the buttons are pressed, a service routine will be called to handle any updating that needs to occur. The CMX-MicroNet TCP/IP Stack written for Freescale for use with the NE64 will be used to handle the Ethernet interface [2].

No consideration has been given to self-tests at this time. However, on initialization, every device will be initialized to safe values. For example, the output of the DC-DC converter will be initialized to 0V to minimize the risk of damage to the device and the user.

3. Software Design Narrative

The following is a general outline of the software to be implemented in the Universal Battery Charger. The code has not been finalized yet, but the general arrangement and function of the blocks is not expected to change significantly in the final version. A graphical summary of the code blocks can be seen in Appendix B.

At startup, before any functional blocks can be run, the microcontroller must go through a setup phase. This setup phase is contained at the very beginning of the addressable memory as well as in an Initialize function. Once the Initialize function is run, the microcontroller will run the Main function in a tight loop.

Initialize:

Purpose: To initialize the microcontroller and the devices connected to it.

What it does: Initialize calls the various initialize functions and then jumps to Main.

Status: In development.

Initialize_Display:

Purpose: To blank the screen and load the BatteryMax logo to the screen.

What it does: Initialize_Display will send 32 blank characters to the screen in order to blank each individual character position. It will then send the characters “BatteryMAX” to the screen.

Status: In development.

Initialize_IO_Ports:

Purpose: To initialize the microcontroller’s I/O ports and other registers.

What it does: Initialize registers and input/output ports, set the stack pointer.

Status: In development.

Initialize_TCP:

Purpose: To initialize the microcontroller’s Ethernet controller.

What it does: Initialize_TCP sets up the CMX-MicroNet TCP/IP Stack.

Status: Undergoing research.

Initialize_DC_DC:

Purpose: To initialize the DC to DC converter that controls the voltage to the battery.

What it does: Initialize_DC_DC sets the output voltage of the DC to DC converter to 0V. This is a safe value intended to prevent injury to the device and the user.

Status: In development.

Poll_TCP:

Purpose: To determine if there is an HTTP request.

What it does: Checks the CMX-MicroNet TCP/IP Stack to see if there is a waiting HTTP request. If there is it will call Serve_Data to service the request.

Status: Undergoing research.

Serve_Data:

Purpose: To service an HTTP request.

What it does: Utilizes the CMX-MicroNet TCP/IP Stack to send out a requested file over the NE64’s Ethernet controller.

Status: Undergoing research.

Poll_Buttons:

Purpose: To check the status of all pushbuttons on the LCD module.

What it does: There are six buttons on the side of the LCD module which will be used as menu navigation buttons. This routine will check these buttons and set a flag if one of them is pushed. .

Status: In development.

Poll_Keypad:

Purpose: To check the status of the 12-key numeric keypad.

What it does: A 12-key numeric keypad will allow the user to input data into the device. This routine will check the keys and set a flag if one of them is pushed.

Status: In development.

Check_Battery:

Purpose: To check the state of the battery.

What it does: Check_Battery calls the routines that check the battery parameters.

Status: In development.

Check_Voltage:

Purpose: To check the voltage across the battery.

What it does: A voltage sensor will be attached in parallel with the battery. Its output will be tied to an analog to digital channel, ATD0. This routine will take the value from ATD0 and convert it to a useful voltage measurement.

Status: In development.

Check_Current:

Purpose: To check the current through the battery.

What it does: A current sensor will be attached in series with the battery. Its output will be tied to an analog to digital channel, ATD1. This routine will take the value from ATD1 and convert it to a useful current measurement.

Status: In development.

Check_Temp:

Purpose: To check the battery’s temperature.

What it does: A temperature sensor will be attached to the battery housing. Its output will be tied to an analog to digital channel, ATD2. This routine will take the value from ATD2 and convert it to a useful voltage measurement.

Status: In development.

Update_Display:

Purpose: To update the output of the display.

What it does: Update_Display will behave differently depending on the mode of operation. If the battery charger is not currently running, the BatteryMax logo will appear. If the user is in the menu system, and a button has been pressed, Update_Display will update to reflect the input. If the battery is charging, useful information about the state of the charge will be printed to the screen.

Status: In development.

Switch_Algorithm:

Purpose: To act as the controller for charging and overall operation.

What it does: Switch_Algorithm will handle charging the battery according to the charging profile prescribed by the specific battery technology. It will also handle any out of bound battery conditions as reported by the voltage, current and temperature sensors. Additionally, it will handle program state changes as input by the user through either of the input devices on the charger.

Status: In development.

4. Summary

In closing, the software side of the BatteryMax Universal Battery Charger has been summarized. A general overview of what the software accomplishes was outlined, the purpose and function of each block was clearly stated, and visual representations of the modules and the flow of software presented in the appendices.

List of References

1] Freescale, “MC9S12NE64 Data Sheet,” [Online Document], accessed February 2007, .

2] Freescale, “Basic Web Server Development with MC9S12NE64 and CMX-MicroNet TCP/IP Stack”, [Online Document], accessed February 2007,



Appendix A: Flowchart/Pseudo-code for Main Program

[pic]

Appendix B: Hierarchical Block Diagram of Code Organization

[pic]

Appendix C: MC9S12NE64 User Configurable Memory Map

[pic]

-----------------------

IMPORTANT: Use standard IEEE format for references, and CITE ALL REFERENCES listed in the body of your report. Any URLs cited should be “hot” links.

NOTE: This is the last in a series of four “design component” homework assignments, each of which is to be completed by one team member. The completed homework will count for 20% of the individual component of the team member’s grade. The body of the report should be 3-5 pages, not including this cover sheet, references, attachments or appendices.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download