Scicos Block
eng - fr


Tri-state Phase/Frequency Comparator block

\epsfig{file=CPF_f.eps,width=90.00pt}

Contents


Palette

Description

This block realizes the comparison between the two event inputs.

\begin{figure}\centering
\scalebox{0.5}{%
\input{cpf_reel.pstex_t}}
\end{figure}
Figure : D flip-flop tri-State Phase/Frequency Comparator

At each event the state of the regular outputs can change according to the last state. When the input events are perfectly synchronized, the high state are realized after one delay.
The following algorithm is a derived model of a model find in [
1]. More descriptions of this Phase/Frequency comparator can be found in [2].

Algorithm

$ \mathtt{{switch(t_{evt})}}$
$ \mathtt{case(t_{CPF})}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}\:\&\:DOWN_{k-1}\right)==0\right)\:Then\:UP_{k}=1\:DOWN_{k}=0}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}==1\right)\:\&\:\left(DOWN_{k-1}==0\right)\right)\:Then\:UP_{k}=1\:DOWN_{k}=0}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}==0\right)\:\&\:\left(DOWN_{k-1}==1\right)\right)\:Then\:t_{RESET+1}=t+\tau}$
$ \mathtt{case(t_{DIV})}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}\:\&\:DOWN_{k-1}\right)==0\right)\:Then\:UP_{k}=0\:DOWN_{k}=1}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}==1\right)\:\&\:\left(DOWN_{k-1}==0\right)\right)\:Then\:t_{RESET+1}=t+\tau}$
$ \mathtt{\;If\:\left(\left(UP_{k-1}==0\right)\:\&\:\left(DOWN_{k-1}==1\right)\right)\:Then\:UP_{k}=0\:DOWN_{k}=1}$
$ \mathtt{case(t_{RESET})}$
$ \mathtt{\;UP_{k}=0\:DOWN_{k}=0}$

Dialog box

\begin{figure}\begin{center}
\epsfig{file=CPF_f_gui.eps,width=400pt}
\end{center}\end{figure}

Default properties

Interfacing function

CPF_f.sci

Computational function (type 4)


/* cpf Scicos Phase/frequency Comparator block
 * Type 4 simulation function ver 1.0 - scilab-3.0
 * 6 janvier 2005 - IRCOM GROUP - Author : A.Layec
 */
 
/* REVISION HISTORY :
 * $Log$
 */
 
#include "scicos_block.h"
#include <stdio.h>

/* Cette fonction de simulation réalise un comparateur phase fréquence
 * trois états. Elle calcule les signaux discrets Up(t) et Down(t) qui
 * sont les sorties logiques de deux bascules D. Les entrées de ces bascules
 * sont placées à 1 et les entrées d'horloges de celles-ci sont les entrées
 * évènementielles du bloc. Lorsque les sorties des deux bascules sont toutes
 * les deux placées à 1, la fonction place les sorties du bloc y[0] et y[1] à 0.
 *
 * entrées d'évenements : dates d'événements Ref(t), Div(t)
 * sortie d'évenement  : néant
 * entrée régulières : néant
 * Sortie régulières : Up(t) et Down(t)
 * paramètres : néant
 * Etats discrets : z[0] et z[1] mémorisent les états précédents des sorties des bascules
 */

/*prototype*/
void cpf(scicos_block *block,int flag)
{
 /*déclaration*/
 int k;
 int nev;
 double *y1, *y2;
 
 /*récupération des adresses*/
 y1=(double *)block->outptr[0];
 y2=(double *)block->outptr[1];
 nev=block->nevprt;
 
 /* Le flag 1 met à jour les sorties un test est réalisé sur les états précédents*/
 if(flag==1)
 {
  /*Appel cpf_c*/
  cpf_c((k=1,&k),&nev,&block->z[0],&block->z[1],&y1[0],&y2[0]);
 }
}

See also

Authors

IRCOM Group Alan Layec

Bibliography

1
A. Demir, ``Analysis and simulation of noise in nonlinear electronic circuits and system,'' Ph.D. dissertation, University of California, Berkeley, 1997.

2
M. Curtin and P. Brien, ``Phase-locked loops for high-frequency receivers and transmitters,'' Analog Dialogue, vol. 33, 1999. [Online]. Available: http://www.analog.com