SUBTITLE [HEBUG.DES] Module Description PAGE *------------------------------------- M O D U L E D E S C R I P T I O N --- * * Module : Description * File : HEBUG.DES * * Version : 3.02 * Date : 22-11-1990 * *------------------------------------------------------------------------------ ******************************************************************************* * * * +------------------------------------------------------------+ * * | ADVANCED DEBUGGER & MONITOR FOR THE MOTOROLA MC6805-SERIES | * * +------------------------------------------------------------+ * * Version: MC68705R3 with analog channels * * Terminal I/O speed = 1200 bps * * * ******************************************************************************* ******************************************************************************* * * Used memory: * - Registers: $0000-$0010 * - RAM : $0010-$0080 * (system stack : $0061-$007F) * - EPROM : $0080-$0F37 * - Vectors : $0FF8-$0FFF * * So, free for user: * - RAM : $0010-$0061 * (end of RAM contains user stack) * - EPROM: $0080-$0F37 * (end of EPROM contains tables) * ******************************************************************************* PAGE *------------------------------------------------------------------------------ * Command function set and Versions history *------------------------------------------------------------------------------ * ******************************************************************************* * * COMMAND FUNCTION SET * ==================== * * Monitor commands: * ----------------- * * HELP / ? : Display a list of all supported commands * * START : Start user program at location $USEROM *: Start user program at location $USEROM * if no input after power-up or no command by user * * GO xxxx : Go to target program * CALL xxxx : Execute subroutine, display effect on registers * and return to monitor * * * # : Remark, the text after the '#'-character is echoed * to the terminal * * * MEMORY xx* : Display and change memory ( zero page ! ) * *=DD : Update location * *=SP : Show next address on same line * *=^ : Previous location on new line * *=/ : Show last examined location on new line * *=CR : Next location on a new line (+print address) * *=. : Terminate process * * * DISPLAY : Display first 128 bytes from memory * ( zero page, I/O and RAM ) * * REGDIS : Display value A- and X-register * REGSET : Set value A- and X-register * * * STORE / RECALL : Reserved for use EEPROM * GETTIM / SETTIM : Reserved for use TIMER/CLOCK * * ******************************************************************************* PAGE ******************************************************************************* * * Typical He-meter commands: * -------------------------- * * MAIN : Start main-program (He-control) by hand * (normally started automatic by time-out) * * ACQSMP : Acquire sample and store result in memory * GIVSMP : Give value sample from memory * * * RON** : Close relais ** = PMP, VLV, ALM * ROF** : Open relais ** = PMP, VLV, ALM * * PMP --> pump relais (used to take sample) * VLV --> valve relais (used to take sample) * AlM --> alarm relais (external alarm) * * LON** : Led on ** = SMP, ALM, FLS * LOF** : Led off ** = SMP, ALM, FLS * * SMP --> sample led (executing sample) * ALM --> alarm led (helium polluted) * FLS --> flush led (reference polluted) * * ALLOFF : Execute all relais and led's off * * * GET** : Get value memory ** = ROF, ATO, FLW * SET** aa : Set value memory ** = ROF, ATO, FLW * contents memory becomes hex-value aa * * ROF --> reference offset (pollution reference) * ATO --> automatic time-out (delay before autostart) * FLW --> flow-counter (counter gasflow helium) * * * GETADC : Get and display ADC channels as 3*(2*HEX+SP) * SETDAC bb : Output hex-value bb to analog pollution-meter * * SCANADC : Scan ADC channels and display it constant as * 3*(2*HEX+TAB) , until a key is hit * * ******************************************************************************* PAGE ******************************************************************************* * * VERSIONS HISTORY * ================ * * Hebug V 2.00 Version derived from the NEFBUG V 4.18, with only the special * functions removed. * * Hebug V 2.01 Led control-list completed * Leds default off * Serial-input echoed again to serial output * * Hebug V 2.02 Specific He-meter lines flagged with HEMETER for later removal. * INEEE time-out implemented. Main-HEprogram starts automaticly if * there is no serial input for INETODV (loaded during INIT) or * HETOREF (loaded later by bug-command). * HEMAIN break routine. During automatic program-flow, the PC can * regain control by sending characters every now-and-then until * the He-meter responds with the standard Bug-prompt. * * Hebug V 2.06 System is now completely ready for IBM-control. Bug mainprogram * is almost complete; only the actual ADC-compare & action * must be added. * * Hebug V 2.07 First version of complete He-meter, with alarm-led, detection, * flush-alarm, etc. * Also, last HKW version. * * Hebug V 2.08 Commands GCNT and SCNT added. Used for GAS volumemeasurement. * First MM version. * * Hebug V 3.00 Version for final design He-meter. Modules added for commu- * nication via I2C-bus, I/O-expander and AD/DA-converter. * Bug mainprogram is rewrited. * Software is splitted in modules. * Jako de Boer version. * * Hebug V 3.01 Command GETFLW changed: it resets the counter to zero now. * * Hebug V 3.02 Routine INCFLW corrected: MSB/LSB swap. * ******************************************************************************* PAGE *------------------------------------------------------------------------------ * Schema of logic controller and I2C-bus *------------------------------------------------------------------------------ * ******************************************************************************* * * Simplified schematic of the logic controller * ============================================ * * RS232 interface * +-------------+ +-------+ 2 * | |-----| |--/--- RS232A * | | | RS232 | 2 * | |-----| |--/--- RS232B * | | +-------+ * | 68705R3 | * | |----- * | | : PB0..7 free * I2C interface | |----- * +-------+ | |----- * 2 | | 4 | | : PC0..7 free * +---/----| I2C |----/-----| |----- * | | | | |----- * | +-------+ | | : PD0..7 free * | __________________________| |----- * |/ /INT | | * | +-------------+ * | * | * | * | * | +--------+ +--------+ * | | |-----| |-----O REL1 * | | |-----| |-----O REL2 * | CIOE_ADDR | PCF |-----| ULN |-----O REL3 * |---------------------------| |-----| | * | | 8574 |-----| 2003 |-----O LED2 * | | |-----| |-----O LED3 * | | |-----| |-----O LED4 * | +--------+ +--------+ * | IO-expander power driver * | * | * | +--------+ * | | |-----O AIN0 ---> CHAN0 * | | |-----O AIN1 ---> CHAN1 * | CADC_ADDR | PCF |-----O AIN2 \ * |---------------------------| | +---> CHAN2 * | | 8591 |-----O AIN3 / * | | | * | | |-----O AOUT * | +--------+ * | AD/DA-converter * | * | * | +--------+ * | | | * | CEEP_ADDR | PCF | * |---------------------------| | * | | 8582 | * | | | * | +--------+ * | EEPROM * | * | * | +--------+ * | | | * | CTIM_ADDR | PCF | * |---------------------------| | * | | 8583 | * | | | * | +--------+ * | Clock and RAM * | * | * | * +------------------------------------------O I2C-Bus * * * ******************************************************************************* PAGE ******************************************************************************* * * Implementation of the I2C-bus protocol * ====================================== * * Currently set up for: - single master system * - NAND's as bus-drivers * - uses software for signal generation * * * * +------------------+ * | | * | MC68705 | * | | Vcc * | / / ^ * | | | * | | | * | | [ ] * | +----------+ | [ ] * | | I2C_DPRT | | [ ] * | +----------+ | | * | | | * | I2C_SDAI |---<--------------------+ * | | | * | | | 2 * | | +----------o I C SDA * | | | * | | +----+ | * | | +--| | *) | * | /I2C_SDAO |--->-----| | & |o-----+ * | | +--| | * | | +----+ * | | * | | * | | * | | Vcc * | / / ^ * | | | * | | | * | | [ ] * | +----------+ | [ ] * | | I2C_CPRT | | [ ] * | +----------+ | | * | | | * | I2C_SCLI |---<---------+----------+ * | | | * | | | 2 * | | +----------o I C SCL * | | | * | | +----+ | * | | +--| | *) | * | /I2C_SCLO |--->-----| | & |o-----+ * | | +__| | * | | +----+ * | | * | | * +------------------+ * * * *) open drain output * ******************************************************************************* PAGE *------------------------------------------------------------------------------ * Structure of software and contents used modules *------------------------------------------------------------------------------ * ******************************************************************************* * * Division software into modules: * ------------------------------- * * * +---------------------------+ * | HEBUG.DES | * +---------------------------+ * * +---------------------------+ * | HEBUG.CFG | * +---------------------------+ * * +---------------------------+ * | HEBUG.INI | * +---------------------------+ * * * +-----------+ +---------------------------------------------+ * | HEBUG.MAI +---+ HEBUG.CTR | Level 1 * +-----+-----+ +-----+---------------------------------------+ * | | | * +-----+---------------+-----+ +-------------+-------------+ * | HEBUG.HEL | | HEBUG.MON | Level 2 * +-----+---------------+-----+ +-------------+-------------+ * | | | * +-----+-----+ +-----+-----+ +-------------+-------------+ * | HEBUG.ADC | | HEBUG.IOE | | HEBUG.SIO | Level 3 * +-----+-----+ +-----+-----+ +-------------+-------------+ * | | | * +-----+---------------+-----+ +-------------+-------------+ * | HEBUG.I2C | | HEBUG.SER | Level 4 * +---------------------------+ +---------------------------+ * * * +---------------------------+ * | HEBUG.STK | * +---------------------------+ * * +---------------------------+ * | HEBUG.TAB | * +---------------------------+ * * +---------------------------+ * | HEBUG.INT & HEBUG.VEC | * +---------------------------+ * * * * The software for the Heliummeter is divided into modules * Every module contains a specific part of the software * * The modules with the actual programm are divided into levels: * Level 1 contains the modules with the main programs * Level 4 contains the modules for the communication * over the I2C and the SERDES-bus * * ******************************************************************************* PAGE ******************************************************************************* * * CONTENTS OF USED MODULES * ======================== * * * Module Description (HEBUG.DES) * * This module contains the description of the Heliummeter. * The descriptions can be divided into four parts: * - The command function set with monitor and typical He-meter commands * - A simplified schematic of the logic controller and the I2C-bus * - The structure and contents of the modules from the software * - The detection of a command in the buffer INLINE * * * Module Configuration (HEBUG.CFG) * * This module contains the configuration and declaration of the He-meter * The module can be devided into four parts: * - Declaration special constants for HEBUG & HEMAIN * - Configuration internal registers of the microcomputer * - I/O-bit positions and declaration of system constants * - Declaration used memory by system * * * Module Initialize (HEBUG.INI) * * This part of the program is started when the power is set on. * There are initialization routines for the I/O-ports of the microcompu- * ter and the I/O-expander. The routines to set or clear the used variables * and counters are executed. After the initialisation there is a delay and * mainwhile a test for input from the Terminal. * * * Module Main Program (HEBUG.MAI) * * This part of the program is started when the Terminal gives no commands * to the Heliummeter. * With this module the Heliummeter measures the pollution of the used * helium and the reference helium. When the pollution of the used helium is * too high, the 'pollution'-led is put on and the alarm-relais is closed. * The 'reference pollution'-led is put on, when the pollution of the reference * helium is too high. The pollution of the used helium is displayed on an * analog meter. * * * Module Control Program (HEBUG.CTR) * * When the Terminal gives a command to the Heliummeter, this module reads * and executes the command. * First the command sent by the Terminal is read and entered in a buffer. * The contents of the buffer is compared with the commands in the command- * tables of the Heliummeter. When the received command from the Terminal is * found in the command-table, the corresponding routine in the programm is * executed. When the received command does not exist, an error message is * given to the Terminal. * * * Module Helium Routines (HEBUG.HEL) * * This module contains the specific Heliummeter routines. * The routines in this module can be divided into three parts: * - Routines for putting leds and relais on or off * - Routines for executing AD- and DA-conversions * - Routines for setting and resetting values of counters * * * Module Monitor Routines (HEBUG.MON) * * This modules contains the monitor routines. * With this module the commands of the Heliummeter for the Terminal can * be displayed. The contents of RAM memory locations and registers can be dis- * played and changed. All routines and subroutines in the program can be * called and executed by a routine in this module. * ******************************************************************************* PAGE ******************************************************************************* * * Module AD/DA-converter (HEBUG.ADC) * * With the subroutines in this module the AD/DA-converter can be used. * It is possible to select a channel for executing a AD-conversion. There * is a subroutine to write a byte to the AD/DA-converter and a subroutine to * read a byte from the AD/DA-converter. * * * Module IO-expander (HEBUG.IOE) * * With the subroutines in this module the IO-expander can be used. * It is possible to set the I/O-pins of the IO-expander as input-pins or * as output-pins. There is a subroutine to write a byte to the IO-expander * and a subroutine to read a byte from the IO-expander. * * * Module SERDES Input/Output (HEBUG.SIO) * * This module contains a routine to read a byte from the Terminal and store * the result into the memory of the microcomputer. There is also a routine * to write a byte to the Terminal. Character-strings and error-messages can * be sent to the Terminal with this module. * * * Module I2C-bus (HEBUG.I2C) * * This module can put the start and stop code on the I2C-bus. There are * subroutines to receive 8 bits from the I2C-bus or to transmit 8 bits over * the I2C-bus. To check if the bits are received, acknowledge bits can be * sent and read. By transmitting a byte over the I2C-bus an ic on the I2C-bus * can be selected. * * * Module SERDES-bus (HEBUG.SER) * * With the routines in this module characters can be transfered over and * recieved from the SERDES-bus. It is possible to look if there are * characters left in the input-buffer. When a carriage return is printed, * automaticly a line feed is inserted. The baudrate can be set at 300, 600 * and 1200 bps. In this module it is tested if a command from the Terminal is * received. When no command is recieved, the Heliummeter will measure the * pollution of the helium independent of the Terminal. * * * Module Stack (HEBUG.STK) * * This modules gives the possibility to push and pull the contents of the * registers on a stack. In the memory of the Microcomputer are bytes reserved * with can be used as an user-stack. The user-stack pointer exists in RAM and * must be initialized. There are macro's defined so the software can use * instructions like PSHA, PULX and LDS. * * * Module Table (HEBUG.TAB) * * This module contains the tables used by the Heliummeter. * The tables in this module can be divided into two parts: * - The command-tables with the commands from the Terminal the Heliummeter * can executed. There are two command-tables and expansion is possible. * The addresses of the command-tables must be in the address-table. * - The string-table with the strings the Heliummeter can send to the Ter- * minal. There are three kinds of strings: strings to give a messages, * strings to ask more input and strings to give an error by wrong input. * * * Module Interrupt & Vector (HEBUG.INT & HEBUG.VEC) * * The module interrupt contains the interrupt routines with must be executed * when an interrupt occures. The module Vector contains the vectors to the * addresses of the interrupt routines. * ******************************************************************************* PAGE *------------------------------------------------------------------------------ * Detection of command and byte/word in input-buffer *------------------------------------------------------------------------------ * ******************************************************************************* * * Input-buffer INLINE: * ==================== * * * Before the command from the Terminal is read, the input-buffer INLINE is * filled with spaces. The command, with possible a following byte, is put * into the buffer INLINE. After the command is read by the Heliummeter, the * command is compaired with the commands in the command-tables. When the * command is found, it will be executed. * After the command may be a byte or a word. A byte contains 8-bits and a * word contains 16-bits. * * The allowed contents of the buffer and the position of the pointer in the * buffer is showed in the following figures. * * * * +--------------------------------------------------------------------+ * | C | O | M | M | A | N | D | | | | B | Y | T | E | | | CR | * +--------------------------------------------------------------------+ * ^ ^ ^ ^ ^ * | | | | | * (A) (B) (C) (D) (E) * * ^ pointer LINOFF to character in buffer INLINE * | position character in memory is INLINE + LINOFF * * * (A) position pointer at begining (entry) of TSTINL * (B) position pointer after ending (exit) of TSTINL * * (B) position pointer at beginning of TSTBYTE * (C) position pointer after ending of TSTBYTE * * (C) position pointer at beginning of SIO_BYTE * (D) position pointer after ending of SIO_BYTE * * (D) position pointer at beginning of SET_GETCR * (E) position pointer after ending of SET_GETCR * ******************************************************************************* PAGE ******************************************************************************* * * COMMAND: * * +------------------------------------------------------+ * | C |(O)|(M)|(M)|(A)|(N)|(D)|(SP)|(SP)|(BYTE)|(SP)| CR | * +------------------------------------------------------+ * ^ ^ ^ ^ * (A) (B) (C) (D) * * * (A) - the first character in INLINE must be the first character * from the command * - not all characters from the command are necessary, abbreviations * of the commands are allowed * * (B) - after the command must be one SP when there follows * a byte after the command * - more SP's after the command are permitted * * (C) - after the command may be a byte or a word * * (D) - after the command (and the byte/word) must be a CR * - SP's before the CR are permitted * ******************************************************************************* ******************************************************************************* * * BYTE/WORD: * * +-----------+----------------------------------+ * | COMMAND |($)| B | Y | T | E |(SP)|(SP)| CR | * +-----------+----------------------------------+ * ^ ^ ^ * (A) (B) (C) * * * (A) - before the byte/word must be a command and one SP * - before the byte/word may be one $ character and more SP's * * (B) - the byte must consist of two characters for a 8-bits value and * the word must consist of four characters for a 16-bits value * * (C) - after the byte/word must be a CR * - SP's before the CR are permitted * ******************************************************************************* *------------------------------------------------------------------------------ * END of Module Description *------------------------------------------------------------------------------ END