📄 yijiangshixian .txt
字号:
function err_code = configHW
% Reset ISL5239 Evaluation Board
[gcConfigStruct,err_code] = GetGC_Config;
if err_code == -1
error('Hardware Error, please check ISL5239 Evaluation Board Connections\n');
end
gcConfigStruct.GC_Mask.eRstHard = 1;
gcConfigStruct.GC_Mask.eRstSoft = 1;
gcConfigStruct.eRstHard = 1;
gcConfigStruct.eRstSoft = 1;
SetGC_Config(gcConfigStruct);
gcConfigStruct.eRstHard = 0;
gcConfigStruct.eRstSoft = 0;
SetGC_Config(gcConfigStruct);
% Setup the PD
pdConfigStruct = GetPD_Config;
pdConfigStruct.PD_Mask.eTest = 1;
pdConfigStruct.eTest = 1;
pdConfigStruct.PD_Mask.eBypass = 1;
pdConfigStruct.eBypass = 0;
pdConfigStruct.PD_Mask.eMagFnSel = 1;
pdConfigStruct.eMagFnSel = 1; % linear voltage
pdConfigStruct.PD_Mask.sOffset = 1;
pdConfigStruct.sOffset = 0;
pdConfigStruct.PD_Mask.usScale = 1;
pdConfigStruct.usScale = 256;
pdConfigStruct.PD_Mask.eActiveLUT = 1;
pdConfigStruct.eActiveLUT = 0;
SetPD_Config(pdConfigStruct);
% Initialize PD LUT to a flat characteristic
lutStruct = GetPD_Table( 0 );
lutStruct.eLUT = 0;
headRoom_dB = 4;
lutStruct.astData.usLUT_DataRe = 10.^(-headRoom_dB/20)*(2^16-1) * ones(1,1024);
lutStruct.astData.sLUT_DataIm = zeros(1,1024);
lutStruct.astData.sLUT_DataDelRe = zeros(1,1024);
lutStruct.astData.sLUT_DataDelIm = zeros(1,1024);
SetPD_Table(lutStruct);
SetPD_Config(pdConfigStruct);
% Setup the conjugate CF
cfCoefTable = getCF_CoefTable;
cfCoefTable.astData.sCoefDataI = [32767 zeros(1,12)];
cfCoefTable.astData.sCoefDataQ = [-32767 zeros(1,12)];
setCF_CoefTable(cfCoefTable);
% Setup the ODC
odcConfigStruct = GetODC_Config;
odcConfigStruct.ODC_Mask.eBypass = 1;
odcConfigStruct.eBypass = 0;
odcConfigStruct.ODC_Mask.eOffsetBinary = 1;
odcConfigStruct.eOutputValType = 1;
SetODC_Config(odcConfigStruct);
find_LUT_power_ranges.m
% find the input power ranges corresponding to the LUT addresses
% column 1: "0" if address is never accessed, "1" otherwise
% column 2: beginning of range in dBFS power
% column 3: end of range in dBFS power
% column 4: LUT address (0 - 1023 decimal)%
% ranges = find_LUT_power_ranges(scale, offset, mode)
function ranges = find_LUT_power_ranges(scale, offset, mode)
k=1; %设定功率回退值
par=10.86; %设定信号功率峰值与均值比
sr=0.22;% 设定饱和点回馈值
power_sat=24.46;%设定饱和点值
lower_q_pont=power_sat-par-k;设定预失真窗口下限
upper_value=power_sat-sr;%设定预失真窗口上限
for a = 0:1023
y = find_upper_limit(a, scale, offset, mode);
if call_calc_addr(y, scale, offset, mode) ~= a % LUT entry isn't used
if
lower(a+1) = -1;
upper(a+1) = -1;
ranges(a+1, 1) = 0; % 旁路I/Q信号
else
ranges(a+1, 1) = 1; %使I/Q参与预失真运算使用LUT表项
upper(a+1) = y;
if a == 0
lower(a+1) = 0;
elseif upper(a) ~= -1
lower(a+1) = upper(a) + 1;
else
lower(a+1) = find_lower_limit(a, scale, offset, mode);
end
end
end
a=1;
full_scale_power = hex2dec('80000')^2 * 2;
ranges(:,2) = lower';
ranges(:,2) = 10*log10(ranges(:,2)/full_scale_power);
upper = ((upper/upper_value) > 1) .* full_scale_power + ((upper/upper_value) <= 1) .* upper;
ranges(:,3) = upper';
ranges(:,3) = 10*log10(ranges(:,3)/full_scale_power);
ranges(:,4) = (0:(length(ranges)-1))';
return;
% address = LUT address to find upper power limit for
% returned value is power level which maps to an address <= provided address
% not all LUT addresses are used in all modes, so returned power level may map to a different
address
function y = find_upper_limit(address, scale, offset, mode)
k = 39; % power is 40 bits wide
guess = 2^k;
while (k > 0)
k = k - 1;
a = call_calc_addr(guess, scale, offset, mode);
if (a > address)
guess = guess - 2^k;
elseif (a < address)
guess = guess + 2^k;
elseif (a == call_calc_addr(guess+1, scale, offset, mode))
guess = guess + 2^k;
end
end
y = floor(guess);
return;
% address = LUT address to find lower power limit for
% returned value is power level which maps to an address >= provided address
% not all LUT addresses are used in all modes, so returned power level may map to a different
address
function y = find_lower_limit(address, scale, offset, mode)
k = 39; % power is 40 bits wide
guess = 2^k;
while (k > 0)
k = k - 1;
a = call_calc_addr(guess, scale, offset, mode);
if (a < address)
guess = guess + 2^k;
elseif (a > address)
guess = guess - 2^k;
elseif (a == call_calc_addr(guess-1, scale, offset, mode))
guess = guess - 2^k;
end
end
y = floor(guess);
return;
function y = call_calc_addr(power, scale, offset, mode)
y = calc_addr(sqrt(power), 0, mode, scale, offset);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -