outbyte (CONTROL_STATUS, MODE_STOP);
dElapsedTime = (UINT32) inbyte (TIMER_BYTE_0);
dElapsedTime |= ((UINT32) inbyte (TIMER_BYTE_1)) << 8;
dElapsedTime |= ((UINT32) inbyte (TIMER_BYTE_2)) << 16;
dElapsedTime |= ((UINT32) inbyte (TIMER_BYTE_3)) << 24;
printf ("Elapsed time = %u.%06u seconds\n",
dElapsedTime / 1000000U, dElapsedTime % 1000000U);
The
TIMER_BYTE_0, TIMER_BYTE_1, TIMER_BYTE_2
and
TIMER_BYTE_3
control
registers are at successive addresses and form a 32-bit register in “little endian” format. It is
possible to read and write the timer’s value in a single 32-bit I/O operation. For example, to read
the timer’s value, the following C statement suffices.
DCounterValue = inlong (TIMER_BYTE_0);
PP 110/01x
9-17
Additional Local I/O Functions
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com