Sensoray 7429 User Manual

Page 17

Advertising
background image

'
' BasePort% is globally visible within this module
'
COMMON SHARED BasePort%'7429 base port address

'
' This subprogram establishes the 7429 base port address for subsequent
' driver calls. Call this procedure before using any other sample
' drivers described in this manual.
'
SUB SetBasePort (Address%)

BasePort% = Address%

END SUB

'
' This subprogram sends a byte to the 7429 command register:
'
SUB SendByte (ByteValue%)

DO: LOOP WHILE (INP(BasePort% + 1) AND 128) = 0'wait for CRMT
OUT BasePort%, ByteValue%

'write command register

END SUB

'
' This function reads a byte from the 7429 data register:
'
FUNCTION ReadByte%

DO: LOOP WHILE (INP(BasePort% + 1) AND 64) = 0'wait for DAV
ReadByte% = INP(BasePort%)

'read data register

END FUNCTION

You may also find the following procedures useful. The first procedure reads a 16-bit
value from the coprocessor, adjusting the sign if necessary. The second procedure sends
a 16-bit value to the coprocessor. Note that these routines call the above procedures.

'
' This function reads a 16-bit value from the coprocessor board.
'
FUNCTION ReadWord%

Value& = ReadByte%(BasePort%)
Value& = Value& * 256 + ReadWord%(BasePort%)
IF Value& > 32767 THEN Value& = Value& - 65536&
ReadWord% = Value&

END FUNCTION

'
' This subprogram sends a 16-bit value to the coprocessor board.
'
SUB SendWord (Value%)

CALL SendByte(BasePort%, Value% \ 256)
CALL SendByte(BasePort%, Value% AND 255)

END SUB

Advertising
This manual is related to the following products: