The Output Pin (Rts/Pin 8) - Campbell SDM-SI01A Product Manual

Table of Contents

Advertisement

'CR1000 example program showing how to detect the state of the input line on an
'SDM-SIO1A using the SDMGeneric instruction
Public
sio1response As Long, Inputstate As Boolean
Const
addr =
0  'constant sdm address CHANGE with SDM-SIO1A address
Const
cmd =
1  'constant, command 1 returns the input state in bit 16
Const
bytes_out =
Const
bytes_val =
Const
big_endian =
Const
delay_usec =
Const Values_in = 1
'Main Program
BeginProg
Scan
(1,Sec,0,0)  'Or whatever scan rate is being used
'Use the SDMGeneric instruction to send command 0x01 which returns the input
'line state as bit 16
SDMGeneric(sio1response,addr,cmd,bytes_out,"",Values_in,bytes_val, _
 big_endian,delay_usec)
'bit 16 set for input line high or low so check the value and set a Boolean
'var TRUE or FALSE accordingly
 Inputstate = sio1response
NextScan
EndProg
The input line can accept 0 and 5V logic inputs OR –12 and +12V RS-232 level inputs. The
following table shows a breakdown of the different input voltages allowed and the state of the
input line flag.
Voltage on the input line State of bit 16
+12V
–12V
5V
0V
A.2 The output pin (RTS/pin 8)
To set the output pin (RTS/pin 8) you must use the
The spare I/O lines are RS-232 lines, NOT logic lines. This means that the output line voltage is
–12V and +12V (approximately), not 0 and 5V.
CRBasic Example 2: Detecting the state of the input line
0  'constant number of bytes out - none sent
2  'two bytes returned
1  '1=(big endian)
-0  'delay between outgoing bytes (negative means delay also
'for incoming bytes)
AND
&H8000
1
0
1
0
SDM-SIO1A and SDM-SIO4A Serial Input/Output Modules
SerialOutBlock()
instruction.
33

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sdm-si04a

Table of Contents