Notes on implementing the Dual DAC output per TCS Axis on the PMAC 1. Each telescope axis has 2 motor requiring 2 pmac DAC per axis. We will assign the pmac DAC outputs as so: HA: DAC1,DAC3 ; default for motor 1 and 3 DEC: DAC2,DAC4 ; default for motor 2 and 4 The general scheme is to have a PLC program run every servo cycle with a simple algorithm: dac0 = PID output from PMAC motor dac1 = motor 1 for axis dac2 = motor 2 for axis base1 = backlash value for dac1. base2 = backlash value for dac2. ; HA : dac0 neg for west; pos for east ; dac1 is west (negative) ; dac2 is east (positive) if( dac0 < 0 ) dac1 = -base1 + dac0; ; go west dac2 = base2; ; backlash else dac1 = -base1; ; backlash dac2 = base2 + dac0; ; go east ; DEC: dac0 neg for north; pos for south ; dac1 is north (negative) ; dac2 is south (positive) if( dac0 < 0 ) dac1 = -base1 + dac0; ; go north dac2 = base2; ; backlash else dac1 = -base1; ; backlash dac2 = base2 + dac0; ; go south Based on some engineering data, the following is determined: The west motor DAC range is 0-negative, base is about -0.31 The east motor DAC range is 0-positive, base is about 0.35 The north motor DAC range is 0-negative, base is about -0.30 The south motor DAC range is 0-positive, base is about 0.43 A value of 0.30 for the base seems reasonable. We use separate base values (base1&2) to allow differenct base values for each motor, and to include a bias value to handle any calibration. Each PMAC card needs it own values (for example if you want 0.30 volts on each value). The D/A conversion can vary by 0.05 volt on each DAC. 2. PMAC implementation notes: The dual_dac program will run as PLC0. Set I05 to 3 to enable foreground & background PLC. Set I08 to 0 to run PLC0 every servo cycle. DPR Variable Open buffer will provide the storage space need for the program. See mem_map.txt for details. To cal base value: Base_volts * 2^16/20v. For example, 0.3v : 0.3v * 2^16/20 v = 983 1.0v : 1.0v * 2^16/20 v = 3276.8 PMAC pdac value scaled by << 8, ie: +/10 V = +-32767 * 256. Plc0 shift the cmd by 8 (cmd/256), so internal it is working with 16-bit data (range -32768 to 32767). When writing the result to the DAC memory locate the results (adc1,adc2) are * 256 to scale back to pmac's format. The base value can be set by changing the mvariables: M8071=983 ; m1_base1 M8072=983 ; m1_base2 M8081=983 ; m2_base1 M8082=983 ; m2_base2 The software performs the above step at startup, see pm_initialize(). The change the default values. Ixx02 pmac defaults are: ixx02 default DAC Use in dual DAC code ---- ------ --- ------------------------------- I102 $078003 DAC1 Motor1 DAC reassigned to WEST (neg) I202 $078002 DAC2 Motor2 DAC reassigned to NORTH (neg) I302 $07800B DAC3 Motor3 DAC reassigned to EAST (pos) I402 $07800A DAC4 Motor4 DAC reassegned to SOUTH (pos) Motor Ixx02 Command Output Address will be modified to reference mx_adc0 in DPR. I102 = $0f80 ; default is DAC1, address $78003 I202 = $1000 ; default is DAC2, address $78002 plc0 will read motor command values, m1 at y:$0f00, m2 at y:$0f01 write adjusted DAC0 values to DAC1&2. write values to DPR for feedback 2. Switching back to single output mode, and other plc notes 2.1 Dual -> single disable plc 0 ; disable plc 0 I102 = $78003 I202 = $78002 2.1 Single -> dual I102 = $0f80 ; memory location for plc0. default is $78003 I202 = $1000 ; memory location for plc0. plc0. default is $78002 enable plc 0 ; enable plc 0