# masterMacs ## Overview This is a driver for the masterMacs motion controller with the SINQ communication protocol. It is based on the sinqMotor shared library (https://git.psi.ch/sinq-epics-modules/sinqmotor). The header files contain detailed documentation for all public functions. The headers themselves are exported when building the library to allow other drivers to depend on this one. ## User guide This driver is a standard sinqMotor-derived driver and does not need any specific configuration. For the general configuration, please see https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md. The folder "utils" contains utility scripts for working with masterMacs motor controllers: - decodeStatus.py: Take the return message of a R10 (read status) command and print it in human-readable form. ## Developer guide ### Usage in IOC shell masterMacs exposes the following IOC shell functions (all in masterMacsController.cpp): - `masterMacsController`: Create a new controller object. - `masterMacsAxis`: Create a new axis object. The full mcu.cmd file looks like this: ``` # Define the name of the controller and the corresponding port epicsEnvSet("NAME","mcu") epicsEnvSet("ASYN_PORT","p$(NAME)") # Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name drvAsynIPPortConfigure("$(ASYN_PORT)","172.28.101.24:1025") # Create the controller object with the defined name and connect it to the socket via the port name. # The other parameters are as follows: # 8: Maximum number of axes # 0.05: Busy poll period in seconds # 1: Idle poll period in seconds # 1: Socket communication timeout in seconds masterMacsController("$(NAME)", "$(ASYN_PORT)", 8, 0.05, 1, 1); # Define some axes for the specified MCU at the given slot (1, 2 and 5). No slot may be used twice! masterMacsAxis("$(NAME)",1); masterMacsAxis("$(NAME)",2); masterMacsAxis("$(NAME)",5); # Set the number of subsequent timeouts setMaxSubsequentTimeouts("$(NAME)", 20); # Configure the timeout frequency watchdog: setThresholdComTimeout("$(NAME)", 100, 1); # Parametrize the EPICS record database with the substitution file named after the MCU. epicsEnvSet("SINQDBPATH","$(sinqMotor_DB)/sinqMotor.db") dbLoadTemplate("$(TOP)/$(NAME).substitutions", "INSTR=$(INSTR)$(NAME):,CONTROLLER=$(NAME)") epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/masterMacs.db") dbLoadTemplate("$(TOP)/$(NAME).substitutions", "INSTR=$(INSTR)$(NAME):,CONTROLLER=$(NAME)") dbLoadRecords("$(sinqMotor_DB)/asynRecord.db","P=$(INSTR)$(NAME),PORT=$(ASYN_PORT)") ``` ### Versioning Please see the documentation for the module sinqMotor: https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md. ### How to build it Please see the documentation for the module sinqMotor: https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md.