Sensoray 421 Manual do Utilizador Página 25

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 27
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 24
Sensoray Model 421 Instruction Manual Page 23
Relay Interface Procedures
FUNCTION ReadRelay% (bankAdrs%, chan%)
‘****************************************************************************
‘ Read relay channel input state.
‘ Imports:
chan% = relay channel in range 0:23.
bankAdrs% = address of relay group (RELAY0 or RELAY2).
‘ Exports:
ReadRelay% = relay channel input state (TRUE or FALSE).
‘****************************************************************************
adrs% = bankAdrs% + chan% \ 8 ‘ Compute relay channel port address
bitMask% = 2 ^ (chan% AND 7) ‘ Compute relay channel bit mask
readRelay% = ((INP(adrs%) AND bitMask%) <> 0) ‘ Read relay input state
END FUNCTION
SUB writeRelay (bankAdrs%, chan%, state%)
‘****************************************************************************
‘ Program relay output.
‘ Imports:
chan% = relay channel in range 0:23.
bankAdrs% = address of relay group (RELAY0 or RELAY2).
state% (boolean): TRUE = relay on, FALSE = relay off.
‘****************************************************************************
Index% = chan% \ 8 ‘ Compute relay%() index and port address
bitMask% = 2 ^ (chan% AND 7) ‘ Compute relay channel bit set mask
invMask% = bitMask% XOR 255 ‘ Compute relay channel bit reset mask
‘ Update relay port output image
relay%(Index%) = (relay%(Index%) AND invMask%) OR (state% AND bitMask%)
OUT bankAdrs% + Index%, relay%(Index%)‘ Write new state to relay channel output register
END SUB
Vista de página 24
1 2 ... 20 21 22 23 24 25 26 27

Comentários a estes Manuais

Sem comentários