# The is the ASYN example for communication to an Aerotech A3200
# "#!" marks lines that can be uncommented.

< envPaths

dbLoadDatabase("$(TOP)/dbd/WithAsyn.dbd")
WithAsyn_registerRecordDeviceDriver(pdbbase)
dbLoadTemplate("a3.asyn.motor.substitutions")

# Configure to use Ethernet
#############################################################################################
#                                                                                           #
# Replace the IP Address and Port on the next line with the IP/Port of your A3200           #
#                                                                                           #
#############################################################################################
drvAsynIPPortConfigure("L0","10.101.2.221:8001",0,0,0)

A3200AsynSetup(1)   /* number of A3200 controllers in system.  */

# Aerotech A3200 asyn motor driver configure parameters.
#     (1) Controller number being configured
#     (2) ASYN port name
#     (3) ASYN address (GPIB only)
#     (4) Number of axes to control
#     (5) Task number to use for motion commands
#     (6) Time to poll (msec) when an axis is in motion
#     (7) Time to poll (msec) when an axis is idle. 0 for no polling
A3200AsynConfig(0, "L0", 0, 2, 1, 1000, 2500)

# Asyn-based Motor Record support
#   (1) Asyn port
#   (2) Driver name
#   (3) Controller index
#   (4) Max. number of axes
#!drvAsynMotorConfigure("MM4",   "motorMM4000", 0, 4)
#!drvAsynMotorConfigure("ANC150","motorANC150", 0, 1)
drvAsynMotorConfigure("L1","motorA3200", 0, 2)

iocInit

# motorUtil (allstop & alldone)
motorUtilInit("IOC:")




