Capsim Block Documentation
This star is a self-contained third order delta sigma modulator.
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | in |
int i; float x; float dd; float aa; float cc; float bb; float ee; float gg; |
|---|
/* note and store the number of output buffers */
if((numberOutputBuffers = NO_OUTPUT_BUFFERS() ) <= 0) {
fprintf(stderr,"ds3: no output buffers\n");
return(1); /* no output buffers */
}
if(numberOutputBuffers > 2) {
fprintf(stderr,"ds3: more than two outputs\n");
return(2);
}
|
|---|
while(IT_IN(0)) {
x = in(0);
g = x - y;
gg = g1 * g;
aa = a;
a = aa + gg;
b = aa - y;
bb = g2 * b;
cc = c;
c = cc + bb;
d = cc - y;
dd = g3 * d;
ee = e;
e = ee + dd;
y = delta;
if(e < 0.0) y = 0.0 - delta;
if(numberOutputBuffers==1) {
if(IT_OUT(0) ) {
KrnOverflow("ds3",0);
return(99);
}
OUTF(0,0)=y;
} else {
if(IT_OUT(0) ) {
KrnOverflow("ds3",0);
return(99);
}
OUTF(0,0)=y;
if(IT_OUT(1) ) {
KrnOverflow("ds3",1);
return(99);
}
OUTF(0,0)=e;
}
}
|
|---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
Copyright (C) 1989-2002 XCAD 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://capsimtmk.sourceforge.net
XCAD Corporation
Raleigh, North Carolina */
|
|---|
/*************************************************************************** ds3.s **************************************************************************** This star is a self-contained third order delta sigma modulator. Ouput 0 is the output of the circuit. Output 1 is the input to the comparator if an output is connected. -Parameter one: the gain of the first integrator -Parameter two: the gain of the second integrator -Parameter third: the gain of the third integrator -Parameter fourth: the value for delta |
|---|