COFFEEPOT device control basics |
Motorola runs a series of courses through "Motorola University" which may heavy use of simulations. A question to ask is "how good are those simulations"? A paraphrase of what the course book states is
A "virtual device" simulation is not meant to be an accurate representation of what the device "does". It is meant to be an accurate representation of what a programmer has to "do".
You are not going to smell the coffee when using the COFFEEPOT virtual device. What you are going to be able experience is the "important" activities associated with the computer control of a device.
The following is the pseudo-code (code concept) needed for laboratory 2 and the control of the COFFEEPOT. You are required to generate the assembly code to perform these operations.
Place_COFFEEPOT_on_DATA_BUS INIT_COFFEEPOT while (temperature < BOILING) Apply_Heat end_while Signal_Water_Boiled while (time < TOO_LONG) Apply_Low_Heat end_while Signal_Coffee_Ready
As with any device, it is necessary to look up the data sheets for the COFFEEPOT device. From this sheet we can see that this device has a number of built in registers. By writing commands to these registers, we can control the activity of the device.
The COFFEEPOT device registers have the following common characteristics.
Every device on a processor's data bus must have a unique base address to ensure that the processor's signals go to the correct device. The base address for the COFFEEPOT device is 0x20000. Later on we shall see how it is possible to connect a number of different devices to the simulator's "buses".
The following "data sheet" information shows the mnemonic (name), offset, and method of control for each of the COFFEEPOT registers. This information can be loaded into our program by including the COFFEEPOT include file cof020.i
Mnemonic | Offset | Allowable Values |
Functionality |
---|---|---|---|
C_CONTROL | 0x20 | RESET (0x8000) | The Control Register is used to set the processor into a known state after "power-up". On the TRAIN and TV device it also provide information about whether the device is ready for read/write operations |
C_WATER | 0x30 | STARTWATER (10) | Opens the Water valve |
CLOSEWATER (0) | Closes the Water Valve | ||
C_HEAT | 0x00 | 0 -- 25 | Determines the amount of heat applied to the COFFEE If not continually written to, the COFFEE water never boils nor the COFFEE perks |
C_TEMPERATURE | 0x10 | Read only | Current water temperature |
C_TIMER | 0xE0 | Read only | Elapsed time (in TICS) since the COFFEEPOT powered up |
C_SCANREGISTER | 0xF0 | DEBUGMODE_NOWAIT (2) | Debug register -- on prototype device only |
These "data sheets" indicate possible values that can be sent to the virtual device to cause it to perform useful tasks. For example, writing the STARTWATER value (10) to the C_WATER register will cause the COFFEEPOT device to open the valve that allows (virtual) water to enter the brewing chamber. To avoid flooding the laboratory, the valve should be closed after a certain elapsed time. This time can be measured by accessing the C_TIMER register.
![]() |
Last modified: July 22, 1996 01:06 PM by M. Smith.
Copyright -- M. R. Smith