PROGRAMING WITHOUT THE PAMUX DRIVER
Pamux User’s Guide
4-9
GAINING AND RELEASING ACCESS
Before reading from or writing to a Pamux analog brain board, you must request access to its internal
registers. This prevents data values from being accessed simultaneously by both an AC28 (or
equivalent) and a brain board.
Gaining Access
First, write the hex value 82 to the control register (AC28 base a Pamux a 1). Then
read the data register (AC28 base a Pamux address) and test bit 7 of the byte just read. Bit 7
is the semaphore bit. When the value of bit 7 is 1, the microprocessor on the Pamux brain board is
updating the contents of the RAM. Once the value of bit 7 becomes 0, you have gained access.
Once you have gained access, the value of bit 7 will continue to be 1 until you release access (as
described below).
The following function illustrates how to gain access to an analog brain board. The GetAccess
function returns True if access is gained, False otherwise. This example tries a fixed number of times
before “giving up,” but a better approach would be to try for a fixed amount of time as well. Note that
access may not be granted if there is a hardware failure.
FUNCTION GetAccess% (DataPortArg%)
CONST SemaphoreRegister% = &H82
CONST MaxTryQty% = 30
‘ Quantity of times to retry
DIM ControlPort%: ControlPort% = DataPortArg% + 1
‘ 2nd register on B6
OUT ControlPort%, SemaphoreRegister%
‘ Point to the semaphore register
DIM TryQty%
‘ Loop counter -- don’t try forever
DIM IsBusy%
‘ Non-zero if busy
FOR TryQty% = 1 TO MaxTryQty%
IsBusy% = INP(DataPortArg%) AND &H80
‘ Get bit 7
IF 0 = IsBusy% THEN
GetAccess% = -1
‘ Return True to indicate success
EXIT FUNCTION
‘ Return
END IF
NEXT
GetAccess% = 0
‘ Return False to indicate failure
END FUNCTION
Releasing Access
This step is crucial.
Once you are finished reading from or writing to the Pamux analog brain
board, you must release access back to the brain board.
If you do not release access, inputs
and outputs will never be updated!
Содержание PAMUX
Страница 10: ...TABLE OF CONTENTS x Pamux User s Guide...
Страница 14: ...TABLE OF CONTENTS xiv Pamux User s Guide...
Страница 103: ...PROGRAMING WITH THE PAMUX DRIVER 3 42 Pamux User s Guide...
Страница 121: ...PROGRAMING WITHOUT THE PAMUX DRIVER 4 18 Pamux User s Guide...
Страница 125: ...TROUBLESHOOTING AND TIPS A 4 A 4 A 4 A 4 A 4 Pamux User s Guide...
Страница 135: ...SPECIFICATIONS B 10 Pamux User s Guide...
Страница 141: ...TEMPERATURE CONVERSIONS ROUTINES C 6 Pamux User s Guide...
Страница 143: ...PRODUCT SUPPORT D 2 Pamux User s Guide...
Страница 149: ...GLOSSARY E 6 Pamux User s Guide...