Purpose of this document

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 List

Module NameModule 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 ModuleTo 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 ModuleTo control two LCD displays and collect data from a NES controllor, as well as driving two analog meters
Measurement ModuleTo collect data from onboard instrumentation including two RS232 interfaced DMMs


Communications Protocol Description

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 performedRequires data block?Returns Data Block?Services a interrupt
0ping the callee. The callee should respond with a system status block
1write nonvolitile memory for (short) blocks starting at address (short). Length of program is compiled in in the static nonvolitile section using a DATA statement.
2read nonvolitile memory for (short) blocks statrting at address (short)
3write volitile scratchpad memory for (short) blocks starting at address (short).
4read volitile scratchpad memory for (short) blocks starting at address (short)
5service a interrupt request, non-urgent
6service a interrupt request, urgent

The following nonvolatile memory addresses are reserved for network operations:
Memory locationPurpose
N0Network bit settings
N1-N16Delay values for module address wake up
N17Number of times to retry transmission
N18collision backoff


Climate Control Module

The climate control module has the following interface lines:

LineFunctionDirectionInitial levelName of driving subroutineMemory location (if applicable)
0Comm Bus TranceveBidirectionalOpenpart of the comm library
1Comm Bus attentionBidirectionalOpenPart of the comm library
2Reserved
3Reserved
4Radiator valve (closed = high, but overriden by fan_out on inverter, indicating water is too hot to use only the core to cool it)OutputLowraddrv:V0
5Header core valve (closed = high)OutputHighcoredrv:V1
6Main pump drive (operating = high, ORed with main drive operating)OutputLowmainpumpdrv:V2
7Peltier pump drive (operating = high)OutputLowauxpumpdrvV3
8heat pump engage (panel sw)InputLowchkengageV4
9heat/cool sliderI/OopenchksliderV5
10pelt heatsink leftI/OopenchkthermistorV6
11pelt heatsink rightI/OopenchkthermistorV7
12pelt coldplate intakeI/OopenchkthermistorV8
13pelt coldplate outputI/OopenchkthermistorV9
14peltier driveI/OopendrvV10
15peltier direction select (high=heat)outputlowdrvV11

Psuedocode for climate control module

Note: this is sheer psuedocode and will not run on anything. The source will be posted later.
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
}


User Interface Module

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:
LineFunctionDirectionInitial levelName of driving subroutineMemory location (if applicable)
0Comm Bus TranceveBidirectionalOpenpart of the comm library
1Comm Bus attentionBidirectionalOpenPart of the comm library
2Reserved
3Reserved
4LCD data bit 0bidirectionallowpart of the LCD library
5LCD data bit 1bidirectionallowpart of the LCD library
6LCD data bit 2bidirectionallowpart of the LCD library
7LCD data bit 3bidirectionallowpart of the LCD library
8LCD/NES strobeoutLowpart of the LCD and NES libraries
9LCD instruct/data, NES clockoutLowpart of the LCD and NES libraries
10LCD read/writeoutlowpart of the LCD library
11LCD 1 enableoutlowpart of the LCD library
12LCD 2 enableoutlowpart of the LCD library
13NES data ininopenpart of the NES library
14Meter 1 outoutopenmtrdrvV0
15Meter 2 outoutopenmtrdrvV1

Complete psuedocode, including network functions:




Host Interface Module

See this for wiring notes on interface cable.