8 read/write 8-bit data register – Omega Vehicle Security OME-PIO-D56 User Manual

Page 39

Advertising
background image

3.3.8 Read/Write 8-bit data Register


(Read/Write):wBase+0xc0/0xc4/0xc8/0xd0/0xd4
Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

D7 D6 D5 D4 D3 D2 D1 D0
Note. Refer to Sec. 3.1 for more information about wBase.

There are five/three 8-bit I/O ports in the OME-PIO-D56/OME-PIO-D24. Each

port is easy to read/write to by access to their own data registers.

outportb(wBase+0xc0,Val);

/* write to D/O port */

Val=inportb(wBase+0xc0);

/* read from D/I port */


outportb(wBase+0xcc,0x07); /* configure Port0~Port2 as DO port */
outportb(wBase+0xc0,i1); /* write to Port0 */
outportb(wBase+0xc0,i2); /* write to Port1 */
outportb(wBase+0xc0,i3); /* write to Port2 */

outportb(wBase+0xcc,0x01); /* configure Port0 as DO port */
/* Port1~Port2 as DI port */
outportb(wBase+0xc0,i1); /* write to Port0 */
j2=inportb(wBase+0xc4); /* read Port1 */
j3=inportb(wBase+0xc8); /* read Port2 */

l=inportb(wBase+0xd0); /* read CON2 Low byte */
h=inportb(wBase+0xd4); /* read CON2 High byte */
Val=(h<<8)+l; /* Val is 16 bit data */

outportb(wBase+0xd0,Val); /* write to CON1 Low byte */
outportb(wBase+0xd4,(Val>>8)); /* write to CON1 high byte */




OME-PIO-D56/OME-PIO-D24 User Manual (Ver.2.1, Oct/2003)

---- 37

Advertising