General description of the software.


The software used in the Shutterwheel and Filterwheel controller, hereinafter called as MCAM, contains three source files which needs to be compiled and link together.

The main part is the source program called MCAM.C the second source program is called PUTCHAR.C and the last part is called STARTUP.A51.

The program MCAM.C is carring all the needed part to interface with the hardware and with the higher-level system software. In fact you can see this program as a interface to the Shutter and Filterwheel. The higher-level software, hereinafter called as MCAD, is actually the system who controlles everything. I'm not gone explain how that system works it is out of the scoop of this document.

The Program PUTCHAR.C is a library function which I had to change to get the communications right between MCAD and MCAM. The standard PUTCHAR function out of the library is using the X-ON and X-OFF protocol. Since MCAD can send every bit of data which is in the range of 0x00 hex and 0xFF hex is where I had to change PUTCHAR because the X-ON and X-OFF values are with-in that range. You normally don't need to compile this one again so you can link it straight with MCAM.

The program STARTUP.A51 is a assembly program and is used for initialising the system on startup. All it does is cleaning the memory and is setting up the stack-area. You need the A51 assebler to compile this bit. But since it is compiled already you only need to use the .obj file and again link it straight away with MCAM.
See for further information the part which explains the compiler. Selectable from the INDEX.


MCAM.C


MCAM is dealing with all the information coming from MCAD as well with the lower interface to the electronics.
The most important function of the program is the shutter timing. I will explain the way this works further on.
First I want to explain the way interfacing is done with the LM628 boards ( for shutter and filterwheel) and the switch interface boards.
This program is dealing with electronic signal which means the program is producing the control-bus signals, the address-bus signals as well as the data-bus signals.
This means that before we can send any data to one of the boards we have to do three actions before.
The first action is to generate the address and write it into a buffer which is done by the second action generating the control-bus signals. Then we can write the data into the buffer and generate again the control-bus signals. If then everything has gone well we than can write again the control-bus signals to get everything to default.
For reading data out of the LM628 boards you have to do exactly the same.


Normally MCAM is doing nothing else then waiting for commands from MCAD. After the string received from MCAD is check it then will carry out it actions needed for the received command. After the command has been executed it then will MCAD let know that it has carried out the action by sending a string with data or without data but always with ACK or NACK.
NACKS are send if MCAM didn't understand the string which could be a command error or a checksum failure.


PUTCHAR.C


Putchar is a normal standard library function which comes with the Keil C51 compiler.
Putchar is the standard low-level character output routine for the stream I/O routines. Putchar is looking for TI to come which means that the output buffer is empty. I could not use the standard function because Putchar is using the X-ON and X-OFF handshake protocol. Since MCAM and MCAD can send or receive all values availble between 0x00 Hex and 0xFF hex is were I had to change the standard library function. This is the only reason why putchar has been changed. The new putchar is compiled and you only need to us the OBJ file in the linker.


STARTUP.A51


The startup.a51 file contains the startup code for a C51 target program. This source file is located in the lib. directory. Include a copy of this file in each 8051 project that needs custom startup code.
The changed file is located in the directory that contains all the other sources as well.
This code is executed immediatly upon reset of the target system and optionally performs the following operations, in order: