Capsim Block Documentation
This star is a self-contained second order delta sigma modulator.
Port | Type | Name | |
---|---|---|---|
0 | float | in |
Num | Description | Type | Name | Default Value | |
---|---|---|---|---|---|
0 | The gain of the first integrator | float | g1 | 1.0 | |
1 | The gain of the second integrator | float | g2 | 1.0 | |
2 | Binary Quantizer Level | float | delta | 1.0 |
Num | Type | Name | Initial Value | Description |
---|---|---|---|---|
0 | float | y | 1.0 | |
1 | float | x | 0.0 | |
2 | float | p | 0.0 | |
3 | float | xold | 0.0 | |
4 | float | yold | 0.0 | |
5 | int | numberOutputBuffers |
int i; |
---|
/* note and store the number of output buffers */ if((numberOutputBuffers = NO_OUTPUT_BUFFERS() ) <= 0) { fprintf(stderr,"ds2: no output buffers\n"); return(1); /* no output buffers */ } if(numberOutputBuffers > 2) { fprintf(stderr,"ds2: more than two outputs\n"); return(2); } |
---|
while(IT_IN(0)) { x = xold + g1*in(0) - g1*p; y = yold + g2*xold - g2*p; p = delta; if(y < 0.0) p = -delta; if(numberOutputBuffers==1) { if(IT_OUT(0)) { KrnOverflow("ds2",0); return(99); } OUTF(0,0)=p; } else { if(IT_OUT(0)) { KrnOverflow("ds2",0); return(99); } OUTF(0,0)=p; if(IT_OUT(1)) { KrnOverflow("ds2",1); return(99); } OUTF(0,0)=y; } xold = x; yold = y; } |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2017 Silicon DSP Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.silicondsp.com Silicon DSP Corporation Las Vegas, Nevada */ |
---|
/*************************************************************************** ds2.s **************************************************************************** This star is a self-contained second order delta sigma modulator. Ouput 0 is the output of the circuit. Output 1 is the input to the comparator if connected. -Parameter one: the gain of the first integrator -Parameter two: the gain of the second integrator -Parameter three: the value for delta |
---|