IDE interface - Hard disk register selection
 Introduction | Register selection | IDE interface | Commands |

Addresses

Functions

CS0-

CS1-

DA2

DA1

DA0

Read (nIOR-)

Write (nIOW-)

1

1

x

x

x

Data bus high impedence

Not used

 

Control block registers

1

0

0

x

x

Data bus high impedence

Not used

1

0

1

0

x

Data bus high impedence

Not used

1

A

1

1

0

Alternate Status

Device Control

1

A

1

1

1

(See note 1)

Not used

 

Command block registers

0

1

0

0

0

Data

Data

0

1

0

0

1

Error

Features

0

1

0

1

0

Sector Count

Sector Count

0

1

0

1

1

Sector Number

LBA (7:0)  (See note 2)

Sector Number

LBA (7:0) (See note 2)

0

1

1

0

0

Cylinder Low

LBA (15:8) (See note 2)

Cylinder Low

LBA (15:8) (See note 2)

0

1

1

0

1

Cylinder High

LBA (23:16) (See note 2)

Cylinder High

LBA (23:16) (See note 2)

0

1

1

1

0

Device/Head

LBA (27:24) (See note 2)

Device/Head

LBA (27:24)(See note 2)

0

1

1

1

1

Status

Command

0

0

x

x

x

Invalid address

Invalid address

Before selecting any command nRESET, nIOR and nIOW lines should be at logic 1 (5 V) always

By putting the correct values on Ad0, Ad1, Ad2, CS0 and CS1, the corresponding register will be selected without any clock signal. So you need only 5 lines to select the registers.

Example :

To select the Command register (This is the register that should be used to send commands to the hard disk. - e.g. Spin down the hard disk, Select the block address )

AD0 = 1 ; AD1 = 1 ; AD2 = 1 ; CS0 = 0 ; CS1 = 1.

How to WRITE a value to the selected register ?

     1. Select the correct register as above.
     2. Put the value to be written on to the data bus (D0 ~ D7).
     3. Now make nIOW line low (logic 0  (0 V)). - This will write the value on the data bus to the selected
          register at the falling edge of the nIOW.
     4. Once the value is written, remember to put the line nIOW to logic 1 again.


How to READ the value in the selected register ?

     1. Select the correct register as above.
     2. Now make nIOR line low (logic 0 (0 V) ) and read the value on data bus (D0 ~ D7).
     3. Once read, remember to put nIOR to logic 1 again.

Now lets look at the simple interface. There are 3 8-bit ports ( A, B, C ) and two of them are bi-directional. I have not included the entire interface here but only the ports that I used. I have implemented this to use with the PC Parallel port initially and later replaced the PC Parallel port interface circuitry with the microcontroller PIC 18F452.  

 

Next  > >

18th January 2003 - Pubudu Goonetilleke

  Home | Science & Research

 

Hosted by www.Geocities.ws

1