The Input Pin (Cts/Pin 11 - Campbell SDM-SIO1A Instruction Manual

Hide thumbs Also See for SDM-SIO1A:
Table of Contents

Advertisement

Appendix A. Using the Handshaking
Lines for General Input/Output
This appendix describes how to use the CTS and RTS lines for input and output ports.
A.1 The Input Pin (CTS/Pin 11)
CRBasic Example A-1. Detecting the State of the Input Line
'CR1000 Example program showing how to detect the state of the input line on an SDM-SIO1A
'Using the SDMGeneric instruction
Public
sio1response
As
Const
addr = 0
Const
cmd = 1
Const
bytes_out = 0
Const
bytes_val = 2
Const
big_endian = 1
Const
delay_usec = -0
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 I/O pins (CTS/pin 11 and RTS/pin 8) can be read or set by the user as
required, allowing unique protocols to be created, or they can simply be used
as flags or enable lines.
If the user enables automatic handshaking as discussed in Section 7.1.1, Using
RTS/CTS and Automatic Handshaking
The state of the input line (pin 11) can be read by using the special
SDMGeneric() instruction in CRBasic.
Bit 16 of a value returned to the datalogger using the SDMGeneric()
instruction reports whether the input is logic high or low. The example below
shows how to call the instruction with the required parameters.
Long, Inputstate
As Boolean
'constant sdm address
'constant, command 1 returns the input state in bit 16
'constant number of bytes out - none sent
'two bytes returned
'1=(big endian)
'delay between outgoing bytes (negative means delay also for incoming bytes)
AND
&H8000
The input line can accept 0 and 5V logic inputs OR –12 and +12V RS-232
level inputs. Below is a breakdown of the different input voltages allowed and
the state of the input line flag.
Voltage on the input line
+12V
–12V
5V
0V
(p. 23)
CHANGE with SDM-SIO1A address
State of bit 16
1
0
1
0
, pins 8 and 11 cannot be accessed.
A-1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sdm-sio4a

Table of Contents