Programming

Relative Addressing vs. Absolute Addressing

The SeaIO API makes a distinction between “absolute” and “relative” addressing modes. In absolute addressing mode, the Port argument to the API function acts as a simple byte offset from the base I/O address of the device. For instance, Port #0 refers to the I/O address 0; Port #1 refers to the I/O address 1.

Relative addressing mode refers to input and output ports in a logical fashion. With a Port argument of 0 and an API function meant to output data, the first (0th) output port on the device will be utilized. Likewise, with a Port argument of 0 and an API function designed to input data, the first (0th) input port of the device will be utilized.

In all addressing modes, port numbers are zero -indexed; that is, the first port is port #0, the second port is #1, the third #2, and so on. The mapping of absolute addressing will always be the same, however, mapping for relative addressing will be dependent on the configuration due to the fact that this device is configurable.

Given Bank 1, Port B2, Port A3 and Port C3 are all inputs and the rest of the ports are outputs, Figure 5 gives the Absolute address, and Figure 6 gives the relative address.

Bank 1 – P2

Bank 2 – P3

Address

Port

Address

Port

0

A1

3

A2

1

B1

4

B2

2

C1

5

C2

Figure 5- Absolute Byte Address (Same for any configuration)

Bank 1 – P2

Bank 2 – P3

Address

Port

Address

Port

0 (input)

A1

0 (output)

A2

1 (input)

B1

3 (input)

B2

2 (input)

C1

1 (output)

C2

Figure 6- Relative Byte Address (Only applies to the given configuration)

OMG-USB-DIO48

Page 9

Page 13
Image 13
Omega Vehicle Security OMG-USB-DIO48 manual Relative Addressing vs. Absolute Addressing