AnsweredAssumed Answered

ADSP-218x using variable between functions

Question asked by skottfelt on Nov 13, 2017
Latest reply on Apr 11, 2018 by SachinV

Hi all

 

I am using an ADSP-218x as a sequencer for a CCD. Normal readout works perfectly well, and I can also perform a process called 'pocket pumping' (where charge is moved back and fourth between the pixels) of the serial register with a single value. However, I want to change that value for every 5 lines I read out and I cannot get that to work.

 

I am trying to change a the value tph in one function (main_function) and then use it in another function (delay_tph), but I find that the tph value does not change, i.e the delay time in delay_tph stays the same, or at least does not act as expected. if I set tph to a fixed value, then it does works as expected. 

Is it a syntax problem, or is it something intrinsic with how DSP works, i.e. that you cannot change a value in one function and then use that value in another function?

 

Thanks in advance

 

Simplified version of the DSP code:

.MODULE/SEG=int_pm main;
.VAR/DM/RAM tphVals [10] {list of the different values I want to use}
.INIT tphVals[0]:1,2,8,16,32,64,128,256,512,1028;
.CONST tph=0;  {the value that should be changed}

primeloop:
{some other functions}
CALL main_funtion;
JUMP primeloop

main_function:
I5=^tphVals;
L5=0;
M5=1;
CNTR=10; {setting number of tphVals}
DO tphloop UNTIL CE;
   AX0=PM(I5,M5); {selecting tph from tphVals, and increment the counter}
   DM(tph)=AX0;   {save the the value to the tph const}
   CNTR=5;  {use the same tph for 5 lines}
   DO lineloope UNTIL CE;
      CALL pump;  {run the pump seq for that line in the serial register}
      CNTR=2300;  {number of pixels in serial register}
      DO rowloope UNTIL CE;
         ... {readout serial register}
      rowloope:NOP;
   lineloope:NOP;
tphloop:NOP;
RTS;

pump_tph:
CNTR=1000; {number of pumps}
DO pumploop UNTIL CE;
   IO(CLOCKS)=MX0; {set clocks to some hex value}
   CALL delayTph; {Pixel integration time}
   IO(CLOCKS)=SR1; {change clocks}
   CALL delayTph; {Pixel integration time}
   IO(CLOCKS)=MR0; {EF1 on}
   ... etc ...
pumploop:NOP;
RTS;

delay_tph:
CNTR=DM(tph); {wait for tph value clock cycles}
DO deltph UNTIL CE;
deltph:NOP;
RTS;

Outcomes