• Keine Ergebnisse gefunden

PROGRAMMING INFORMATION

Im Dokument INPUT MUL (Seite 21-25)

3-1.

INTRODUCTION

This chapter describes the user programming required for the iSBX 311 Analog Input Multimodule Board. Included are sections on addressing, com-mand formats, data selection formats, interrupt servicing, and programming examples.

3-2.

ADDRESSING

The Multimodule board is addressed by executing an IN or OUT instruction in the host iSBC micro-computer to one of the legal port addresses for the Multimodule board. Since some host iSBC micro-computers will accept up to three Multimodule boards, the upper address byte for each iSBX bus connector will vary, as table 3-1 shows. The port addresses vary according to whether an 8-bit board or a 16-bit board is used as the host iSBC microcom-puter board.

3-3.

COMMAND FORMAT

The Multimodule board is capable of responding to 2 types of commands, READ commands and WRITE commands. The READ command causes digital data (high byte, low byte, or status) to be transferred to the host iSBC microcomputer and the WRITE command transfers the channel address to the Multimodule board to select which channel will be converted. Each of the commands is issued by the host iSBC microcomputer via either an IN or an OUT instruction directed to one of the legal port·

addresses.

The WRITE command must select the channel on the Multimodule board which is to be converted; this consists of loading the channel selection byte into

the A register before the OUT instruction is directed to one of the legal WRITE port addresses for the Multimodule board (see table 3-1). The format of the channel selection byte is shown in figure 3-1. The channel selection byte (bits CO, C1, C2, and C3) is decoded by the Multimodule board to select one of the 16 (for single ended operation) or one of 8 (for differential operation) analog input channels. The high order bits (X, X, X, X) are not used. The WRITE command is issued via an OUT instruction. When the OUT command is executed by the host iSBC microcomputer, the accumulator must contain the proper channel address, as listed in table 3-2.

When a READ command (IN instruction) is directed to one of the legal Multimodule port addresses and is decoded by the Multimodule board, the command causes converted digital data to be sent to the host iSBC microcomputer from the Multimodule board·

data buffers. The READ command may call for either the status of the Multimodule board, the LOW BYTE of converted data, or the HIGH BYTE of converted data. The data, recall, is the result of an analog data conversion sequence from the channel selected by the previous WRITE command. The distinction between the LOW and HIGH data bytes is performed by the port address used; refer to table 3-1.

NOTE

The RESET occurring as a result of power-on will not clear the interrupt request signal (INTRa) from the Multimodule board.

Therefore, a READ HIGH BYTE command should be issued after power-up to clear the INTRa signal before starting an operation.

Table 3-1. 1/0 Port Addresses

Multi-SELECT ADDRESS ·module board and initiate conversion.

Note: Refer to the Hardware Reference Manual for your host iSBC microcomputer to determine the upper digit (X) of the Multimodule port address.

Programming Information

bit position 7 6 5 4 3 2 0

Channel Select Byte r-1-X- r -X---.-I-X---.-I-X--r-I-C-3 ... I-C-2..,.I-C-1..,.'-C-0 ...

I

Figure 3-1. Channel Selection Byte Format

3-4.

DATA FORMAT

A READ command is issued to the multimodule board to initiate a READ operation in which converted data is sampled by the host iSBC micro-computer. The digital data created within the Multimodule board is the result of operation of the SAR, the DAC, and the comparator to transform the analog input data into 12 bits of digital data which are left-justified through two three-state multi-plexers to form two 8-bit bytes of digital data. The format of the digital data bytes created by the Multimodule board is shown in figure 3-2. Bits DO through D3 of the low byte interface to bidirectional bus lines MD4 through MD7, respectively. The low byte includes one unused bit (bit 3) and the status bits (EOC/, BUSY I, and START I on MDO, MD1, and MD2, respectively). The high byte includes data bits D4 through Dll which are transferred on bidirectional bus lines MDO through MD7, respec-tively.

iSBX 311

bit position 7 6 5 4 3 2 1 0 LOW BYTE

I

03' 02101 'DO' 0 'START / , BUSy/I EOC/

HIGH BYTEID111D10lD91081D71 D6 D5 D4

Figure 3-2. Data Format

3-5.

STATUS FORMAT·

Status for the Multimodule board is contained in the three least significant bits of the LOW BYTE of data (see figure 3-2). The status is read by the host iSBC microcomputer whenever a READ LOW BYTE command is issued by the host iSBC microcomputer to the Multimodule board. When a READ LOW BYTE command is issued, the status bits are released onto the MDO, MDl, and MD2 data lines.

The START I status bit (bit 2) is used by the host iSBC microcomputer to determine whether or not the A-to-D converter on the Multimodule board has started data conversion. When the START I bit is LOW, it indicates that the Multimodule board is in the process of sampling the analog data input; i.e., the A-to-D conversion is begun. When the STARTI bit is HIGH, it indicates that the data sampling is completed.

Table 3-2. WRITE Commands

COMMAND* CHANNEL** MODE FUNCTION

SELECTION BYTE

iSBX 311

The BUSY 1 status bit (bit 1) is generated by the SAR to show the condition of the successive approximation routine that occurs for each data input sequence on the Multimodule board. When the dat conversion is started, the BUSY 1 signal goes LOW a maximum of 3.8 microseconds after START 1 goes LOW. When the board is finished converting·

the analog data to digital data, BUSY 1 goes HIGH, indicating that the conversion within the SAR is fully completed; i.e., data is available in the form of a HIGH BYTE and LOW BYTE.

The EOCI status bit (bit 0) is used by the host iSBC microcomputer to determine the end of conversion when the host must determine the status of the Multimodule board by polling the status byte. The EOCI status bit is reset by issuing a READ HIGH BYTE command to the Multimodule board. The interrupt line (INTRO) from the Multimodule board is an inverted version of the EOCI signal and is also reset on a READ HIGH BYTE command. The interrupt line may be used to request an interrupt from the host iSBC microcomputer at the end of a conversion.

3-6. PROGRAMMING EXAMPLE

Table 3-3 contains a programming example for the Multimodule board that will read data from each of sixteen single-ended analog input channels and store the converted data in a 32-byte table in memory. A program for a differential system would be similar, with the exception that only 8 channel inputs are available. The example uses a data table to store up to 32 bytes of converted analog data input through the Multimodule board. All 16 channels are scanned, implying that the Multi-module board is configured to operate in the single ended mode. The end of a conversion cycle is sensed by polling for the EOCI signal transition. The port addresses used in the sample program are for use with an iSBC 80/24 board (J6 Multimodule board connector) and may have to be altered if another host or another Multimodule connector is required.

For proper port addresses, refer to table 3-1 of this manual.

Programming Information

Table 3-3. Programming Example

TABLE: OS 32 ;Define data table.

CHAPTER 4

Im Dokument INPUT MUL (Seite 21-25)