ds3

Capsim Block Documentation

Short Description

This star is a self-contained third order delta sigma modulator.

Top
Input Connections
Port Type Name
0 float in
Top
Parameters
Num Description Type Name Default Value
0 Gain of first integrator float g1 1.0
1 Gain of second integrator float g2 1.0
2 Gain of third integrator float g3 1.0
3 Binary Quantizer Level float delta 1.0
Top
States
Num Type Name Initial Value Description
0 float y 1.0
1 float a 0.0
2 float b 0.0
3 float c 0.0
4 float olda 0.0
5 float oldc 0.0
6 float olda1 0.0
7 float oldc1 0.0
8 float d 0.0
9 float e 0.0
10 float g 0.0
11 int numberOutputBuffers
Top

Declarations


 

	int i;
	float x;
	float dd;
	float aa;
	float cc;
	float bb;
	float ee;
	float gg;



Top

Initialization Code



 

       /* 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); 
	}




Top

Main Code



 

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;

	}

}




Top

Wrapup Code



 





Top

License



/*  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
*/


Top

Description



 

/***************************************************************************
		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

ds3


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


Programmer:	John T. Stonick
Date:		February 1989

*/