function to return the phase switch state of the backend e.g d=statusRegisterSouth(d) adds the following to the d class: 1.d.flags.phaseSwitchState 2.d.flags.noiseDiode CJC 25 Janaury 2013
0001 %function to return the phase switch state of the backend 0002 %e.g d=statusRegisterSouth(d) 0003 % adds the following to the d class: 0004 %1.d.flags.phaseSwitchState 0005 %2.d.flags.noiseDiode 0006 %CJC 25 Janaury 2013 0007 0008 0009 function d = statusRegisterSouth(d) 0010 0011 0012 status = d.antenna0.roach2.switchstatus; 0013 statusND = d.antenna0.roach1.switchstatus; 0014 outputstatus = uint16(zeros(length(status),1)); 0015 %after 11 Janaury the mapping of the status register is as follows: 0016 %9-MSB PSwitch0 (MSB-5) 0017 %8-MSB-1 = PSwitch1 (MSB-4) 0018 %7-MSB-2 = P.Switch2 (MSB-3) 0019 %6-MSB-3 = P.Switch3 (MSB-2) 0020 %5-MSB-4 = NA 0021 %4-MSB-5 = P.Switch4 (MSB-1) 0022 %3-MSB-6 = P.Switch5 (MSB) 0023 %2-MSB-7 = NA 0024 %1-MSB-8 = NDIODE 0025 SizeofStatusRegister=9; 0026 PSwitch=[9 8 7 6 4 3]; %mapping of the bits (with MSB of the status register labelled as BIT1) of the PSwitch from LSB upward% note that this is using 1 as a starting index 0027 ND = [1] 0028 for i = 1:length(PSwitch) 0029 posn=PSwitch(i); 0030 a=bitget(status,posn); 0031 outputstatus=bitset(outputstatus,i,a); 0032 end 0033 NoiseDiode=bitget(statusND,ND(1)); 0034 d.flags.phaseSwitchState=outputstatus; 0035 d.flags.noiseDiode=NoiseDiode; 0036 0037