National Instruments 320174B-01 用户手册

下载
页码 182
Chapter 4
Register-Level Programming
© National Instruments Corporation
4-35
Lab-NB User Manual
Configuration EPROM
The Configuration EPROM is an onboard read-only memory that contains information required
by the Macintosh operating system.  The Macintosh system Slot Manager reads the
Configuration EPROM upon system startup.
The Configuration EPROM is mapped to address offset locations F 8000 through F FFFC.  The
EPROM is 8 bits (1 byte) wide and 8 kilobytes in length.  Each byte of the EPROM is mapped to
every fourth address location on the Lab-NB board as follows:  the first byte is read from slot
address + F 8000; the second byte is read from slot address + F 8004; the third byte is read from
slot address + F 8008, and so on.
Programming Considerations
The following paragraphs contain programming instructions for operating the circuitry on the
Lab-NB board.  Programming the Lab-NB involves writing to and reading from the various
registers on the board.  The programming instructions included here list the sequence of steps to
take.  The instructions are language independent; that is, they tell you to write a value to a given
register, to set or clear a bit in a given register, or to detect whether a given bit is set or cleared
without presenting the actual code.
Register Programming Considerations
Registers in the Macintosh are memory mapped; that is, writing to a register involves storing a
value in a memory location.  A register is read by reading this memory location.  Only memory
location reads and writes can be performed on the Lab-NB registers.  Mathematical or logical
operations cannot be directly applied to the Lab-NB registers.  Attempting to do so results in
unpredictable program behavior.
Several write-only registers on the Lab-NB contain bits that control several independent pieces
of the onboard circuitry.  In the set or clear instructions provided, specific register bits should be
set or cleared without changing the current state of the remaining bits in the register.  However,
writing to these registers affects all register bits simultaneously.  You cannot read these registers
to determine which bits have been set or cleared in the past; therefore, you should maintain a
software copy of the write-only registers.  This software copy can then be read to determine the
status of the write-only registers.  To change the state of a single bit without disturbing the
remaining bits, set or clear the bit in the software copy and then write the software copy to the
register.
Initializing the Lab-NB Board
The Lab-NB hardware must be initialized for the Lab-NB circuitry to operate properly.  To
initialize the Lab-NB hardware, complete these steps:
1. Write 38 (hex) to the Counter A Mode Register (8-bit write).
2. Write 78 (hex) to Counter A Mode Register (8-bit write).
3. Write 00 (hex) to the Interrupt Control Register (8-bit write).