This document exists as a description of the individual 'modules' in the car's network, the communication protocol used between these modules, and codepage maps of these modules.
Module Name | Module Purpose |
Climate Control Module (CCM) | To control the peltier array and solenoid valves that are used to regulate cabin tempurature |
Host Interface Module (HIM) | To control power to the main system computer and to communicate between the main system computer and the rest of the bus |
Main Module | To control power to the battery charger during charging and the power steering pump during vehicle operation, as well as collecting tach and vehicle speed data |
User Interface Module | To control two LCD displays and collect data from a NES controllor, as well as driving two analog meters |
Measurement Module | To collect data from onboard instrumentation including two RS232 interfaced DMMs |
The communcations protocol is by neccessity simplistic - among other things, it is necccesary to impliment this protocol on computers with 128 bytes of RAM (!). So, that having been said, here is the basic idea. All modules connect togeather via two wires on a bus. The first wire is used for attention signalling, the second wire for data signalling. Normally, all modules service their process requests - however, when it becomes neccesary for a module to send data it brings the attention line low. Then that modules pauses for a time (stored in nvram) that corrisponds to the wakeup delay for the module that module is trying to address.
The module being addressed responds with it's own address. The calling module will retry the address until the called module responds, or until retry events occur (another variable stored in nonvoliatile memeory)
The module addressing then sends a instruction block, and then delays long enough for the module to recover (again, hardcoded value), and then sends a data block.
The instructions for this block are as follows:
Instruction # | Operation performed | Requires data block? | Returns Data Block? | Services a interrupt |
0 | ping the callee. The callee should respond with a system status block | |||
1 | write nonvolitile memory for (short) blocks starting at address (short). Length of program is compiled in in the static nonvolitile section using a DATA statement. | |||
2 | read nonvolitile memory for (short) blocks statrting at address (short) | |||
3 | write volitile scratchpad memory for (short) blocks starting at address (short). | |||
4 | read volitile scratchpad memory for (short) blocks starting at address (short) | |||
5 | service a interrupt request, non-urgent | |||
6 | service a interrupt request, urgent |
The following nonvolatile memory addresses are reserved for network operations:
Memory location | Purpose |
N0 | Network bit settings |
N1-N16 | Delay values for module address wake up |
N17 | Number of times to retry transmission |
N18 | collision backoff |
Line | Function | Direction | Initial level | Name of driving subroutine | Memory location (if applicable) |
0 | Comm Bus Tranceve | Bidirectional | Open | part of the comm library | |
1 | Comm Bus attention | Bidirectional | Open | Part of the comm library | |
2 | Reserved | ||||
3 | Reserved | ||||
4 | Radiator valve (closed = high, but overriden by fan_out on inverter, indicating water is too hot to use only the core to cool it) | Output | Low | raddrv: | V0 |
5 | Header core valve (closed = high) | Output | High | coredrv: | V1 |
6 | Main pump drive (operating = high, ORed with main drive operating) | Output | Low | mainpumpdrv: | V2 |
7 | Peltier pump drive (operating = high) | Output | Low | auxpumpdrv | V3 |
8 | heat pump engage (panel sw) | Input | Low | chkengage | V4 |
9 | heat/cool slider | I/O | open | chkslider | V5 |
10 | pelt heatsink left | I/O | open | chkthermistor | V6 |
11 | pelt heatsink right | I/O | open | chkthermistor | V7 |
12 | pelt coldplate intake | I/O | open | chkthermistor | V8 |
13 | pelt coldplate output | I/O | open | chkthermistor | V9 |
14 | peltier drive | I/O | open | drv | V10 |
15 | peltier direction select (high=heat) | output | low | drv | V11 |
initilize lines initilize comm library while(1) { check attention line, service network if neccesary increment counter variable if counter variable is pegged, rese it if counter variable mod (rescan therm time) rescan thermistors if counter variable mod (rescan slider/control time) rescan slider/control gosub calculate_drive(); } calculate_drive() : baseline = slider; if baseline > (configged core turnon) engage core; if baseline > (configged radiator cutout) cutout radiator;. (hardware will open radiator anyway if inverter's fan drive output is high if heatsinktemp1 or heatsinktemp2 > stored cutoff temp return if coldplateoutlettemp > stored cutoff temp return if heatsinktemp - coldplatetemp > stored efficient value and mode = cool return drive peltier line with output pulse, width determined by baseline - tempdiff lookup }
The user interface module is responsable for all communication between the user and the computer system (except for voice I/O, which is the subject of another document). The UI module can run in two modes, interrupt-generating and non-interrupt generating. In order to lower bus congestion, I suspect it will be desirable to run it in interrupt generating mode all the time, but the code is there either way.
You may wish to see this link to understand the NES controllor better. One other thing to bear in mind - there's a slight mod to the network call on this program. If the network must service a interrupt, it drives a time-scaled out pulse to the meters to keep them from 'dipping'. The IO lines on this module are assigned as follows:
Line | Function | Direction | Initial level | Name of driving subroutine | Memory location (if applicable) |
0 | Comm Bus Tranceve | Bidirectional | Open | part of the comm library | |
1 | Comm Bus attention | Bidirectional | Open | Part of the comm library | |
2 | Reserved | ||||
3 | Reserved | ||||
4 | LCD data bit 0 | bidirectional | low | part of the LCD library | |
5 | LCD data bit 1 | bidirectional | low | part of the LCD library | |
6 | LCD data bit 2 | bidirectional | low | part of the LCD library | |
7 | LCD data bit 3 | bidirectional | low | part of the LCD library | |
8 | LCD/NES strobe | out | Low | part of the LCD and NES libraries | |
9 | LCD instruct/data, NES clock | out | Low | part of the LCD and NES libraries | |
10 | LCD read/write | out | low | part of the LCD library | |
11 | LCD 1 enable | out | low | part of the LCD library | |
12 | LCD 2 enable | out | low | part of the LCD library | |
13 | NES data in | in | open | part of the NES library | |
14 | Meter 1 out | out | open | mtrdrv | V0 |
15 | Meter 2 out | out | open | mtrdrv | V1 |
Complete psuedocode, including network functions:
See this for wiring notes on interface cable.