CDS-3310
Chapter
7 Application Programming
i
51
Digital Inputs
The general digital inputs for are accessed by using the @IN[n] function or the TI command. The
@IN[n] function returns the logic level of the specified input, n, where n is a number 1 through 96.
Example - Using Inputs to control program flow
Instruction Interpretation
JP #A,@IN[1]=0
Jump to A if input 1 is low
JP #B,@IN[2]=1
Jump to B if input 2 is high
AI 7
Wait until input 7 is high
AI -6
Wait until input 6 is low
Example - Start Motion on Switch
Motor A must turn at 4000 counts/sec when the user flips a panel switch to ‘on’. When panel switch is
turned to ‘off’ position, motor A must stop turning.
Solution: Connect panel switch to input 1 of CDS-3310. High on input 1 means switch is in ‘on’
position.
Instruction Interpretation
#S;JG 4000
Set speed
AI 1;BGA
Begin after input 1 goes high
AI -1;STA
Stop after input 1 goes low
AMA;JP #S
After motion, repeat
EN;
Analog Inputs
The controller has two analog inputs and provides eight analog inputs with the addition of the DB-
28040. The value of these inputs in volts may be read using the @AN[n] function where n is the
analog input 1 through 8. The resolution of the Analog-to-Digital conversion is 12 bits (16-bit optional
– Consult Galil). Analog inputs are useful for reading special sensors such as temperature, tension or
pressure.
The following examples show programs which cause the motor to follow an analog signal. The first
example is a point-to-point move. The second example shows a continuous move.
Example - Position Follower (Point-to-Point)
Objective - The motor must follow an analog signal. When the analog signal varies by 10V, motor
must move 10000 counts.
Method: Read the analog input and command A to move to that point.
Instruction Interpretation
#POINTS Label
SP 7000
Speed
AC 80000;DC 80000
Acceleration
#LOOP
vp=@AN[1]*1000
Read and analog input, compute position
PA vp
Command position
BGA Start
motion
Summary of Contents for CDS-3310
Page 26: ...18 i Chapter 2 Getting Started CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 32: ...24 i Chapter 3 Connecting I O CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 124: ...CDS 3310 Chapter 8 Hardware Software Protection i 63 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 138: ...CDS 3310 Chapter 10 Theory of Operation i 77 THIS PAGE LEFT BLANK INTENTIONALLY...