Appendix e register-level programming, Register programming considerations, Initializing the lab-pc+ board – National Instruments Low-Cost Multifunction I/O Board for ISA Lab-PC+ User Manual

Page 157: Appendix, Register-level programming

Advertising
background image

© National Instruments Corporation

E-1

Lab-PC+ User Manual

Appendix E
Register-Level Programming

This appendix contains important information about programming the Lab-PC+.

Programming the Lab-PC+ 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

The Lab-PC+ can only be used for 8-bit I/O transfers, thus all the I/O read-and-write operations
are 8-bit operations.

Several write-only registers on the Lab-PC+ 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-PC+ Board

The Lab-PC+ hardware must be initialized in order for the Lab-PC+ circuitry to operate properly.
To initialize the Lab-PC+ hardware, complete these steps:

1.

Write 00 (hex) to the Command Register 1.

2.

Write 00 (hex) to the Command Register 2.

3.

Write 00 (hex) to the Command Register 3.

4.

Write 00 (hex) to the Command Register 4.

5.

Write 34 (hex) to Counter A Mode Register.

6.

Write 0A (hex) to Counter A0 Data Register.

7.

Write 00 (hex) to Counter A0 Data Register.

Advertising