ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:74.31KB ,
资源ID:10518180      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10518180.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(10通信原理综合标准实验报告.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

10通信原理综合标准实验报告.docx

1、10通信原理综合标准实验报告实验十九 通信原理综合实验 BPSK调制解调【设计要求】设计2PSK调制解调器。设计环境:设计指标:BPSK调制载波由信号 发生器参数,数据信号由微机参数,两个信号不同步。载波信号幅度Vpp2V,标称频率100Hz,误差10PLL入锁频率范围10Hz跟踪范围20Hz数据信号速率5 baud,0/1方波。【系统设计】1 总体设计根据系统设计指标,设计系统框图如下:调制系统由乘法器构成。硬件信号发生器产生的载波信号与本地信号发生器产生的调制信号构成。 其中:为载波频率,为载波初始相位。解调系统由载波恢复电路和相干解调器构成。由于BPSK信号中没有载波频率分量,因此,需要

2、进行非线性变换。为进行系统性能比较,设计一非同步解调参考解调电路。2 载波恢复模块设计 载波恢复模块由平方倍频器与分频PLL构成 平方器输出为:在实际应用中A为缓变量,因此,要滤除直流分量不能用常量减法,只能用高通滤波器,其传递函数为: PLL电路构成如下: 环路中加入倍频器,锁相输出频率为1/2输入频率。 为使环路得到较好的稳定性,环路滤波器采用一阶滤波器。 根据系统入锁频差要求大约在1020Hz之间。(选10Hz) 由于BPSK信号的相位为阶跃函数,为保证跟踪锁相环开环增益在保证环路稳定的条件下取较大值,开环增益中起主要作用的VCO增益取5000Hz/V。3 解调电路设计解调电路由乘法器与

3、低通滤波器构成。为保证低频数字信号的波形,采用通带平坦型2阶BUTTER低通滤波器,使通带内的相移较小。截止频率20Hz4 采集卡驱动程序设计MATLAB用S函数编写硬件接口,S函数在MATLAB中的调用过程为根据接口定义与要求,驱动程序由下列程序构成:test_matlab.cpp:/* $Revision: 1.3 $ */ Automatically generated by MATLAB Project Wizard version 1.0/* * Based on sfuntmpl_basic.c: Basic C template for a level 2 S-function.

4、 * * - * | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template | * - * * Copyright 1990-2000 The MathWorks, Inc. * $Revision: 1.3 $ */#include iostream.h#include #include #include P1202DRV.HP1202DRV MyDrv;#ifdef _cplusplusextern C / use the C fcn-call standard for all functions #

5、endif / defined within this scope /* * You must specify the S_FUNCTION_NAME as the name of your S-function * (i.e. replace sfuntmpl_basic with the name of your S-function). */#define S_FUNCTION_LEVEL 2#define S_FUNCTION_NAME test_matlab/* * Need to include simstruc.h for the definition of the SimStr

6、uct and * its associated macro definitions. */#include simstruc.h/* Error handling * - * * You should use the following technique to report errors encountered within * an S-function: * * ssSetErrorStatus(S,Error encountered due to .); * return; * * Note that the 2nd argument to ssSetErrorStatus must

7、 be persistent memory. * It cannot be a local variable. For example the following will cause * unpredictable errors: * * mdlOutputs() * * char msg256; ILLEGAL: to fix use static char msg256; * sprintf(msg,Error due to %s, string); * ssSetErrorStatus(S,msg); * return; * * * See matlabroot/simulink/sr

8、c/sfuntmpl_doc.c for more details. */*=* * S-function methods * *=*/* Function: mdlInitializeSizes = * Abstract: * The sizes information is used by Simulink to determine the S-function * blocks characteristics (number of inputs, outputs, states, etc.). */static void mdlInitializeSizes(SimStruct *S)

9、/* See sfuntmpl_doc.c for more details on the macros below */ ssSetNumSFcnParams(S, 0); /* Number of expected parameters */ if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S) /* Return if number of expected != number of actual parameters */ return; ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0

10、); if (!ssSetNumInputPorts(S, 0) return; /ssSetInputPortWidth(S, 0, 1); /ssSetInputPortRequiredContiguous(S, 0, true); /*direct input signal access*/ /ssSetInputPortDirectFeedThrough(S, 0, 1); if (!ssSetNumOutputPorts(S, 1) return; ssSetOutputPortWidth(S, 0, 1); ssSetNumSampleTimes(S, 2); ssSetNumRW

11、ork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 1); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /ssSetOptions(S, 0); /ssSetOptions(S, SS_OPTION_ALLOW_CONSTANT_PORT_SAMPLE_TIME);/* Function: mdlInitializeSampleTimes = * Abstract: * This function is used to specify the sample time(s) for your *

12、 S-function. You must register the same number of sample times as * specified in ssSetNumSampleTimes. */static void mdlInitializeSampleTimes(SimStruct *S) ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); ssSetSampleTime(S, 1, 1.0/SAMPLERATE); ssSetOffsetTime(S, 1, 0.0); /ss

13、SetOutputPortSampleTime(S, 0, 0.01); /ssSetOutputPortOffsetTime(S, 0, 0);/#define MDL_INITIALIZE_CONDITIONS /* Change to #undef to remove function */#undef MDL_INITIALIZE_CONDITIONS#if defined(MDL_INITIALIZE_CONDITIONS) /* Function: mdlInitializeConditions = * Abstract: * In this function, you shoul

14、d initialize the continuous and discrete * states for your S-function block. The initial states are placed * in the state vector, ssGetContStates(S) or ssGetRealDiscStates(S). * You can also perform any other initialization activities that your * S-function may require. Note, this routine will be ca

15、lled at the * start of simulation and if it is present in an enabled subsystem * configured to reset states, it will be call when the enabled subsystem * restarts execution to reset the states. */ static void mdlInitializeConditions(SimStruct *S) #endif /* MDL_INITIALIZE_CONDITIONS */#define MDL_STA

16、RT /* Change to #undef to remove function */#if defined(MDL_START) /* Function: mdlStart = * Abstract: * This function is called once at start of model execution. If you * have states that should be initialized once, this is the place * to do it. */ static void mdlStart(SimStruct *S) /* for(i=0;iIni

17、t() ssSetErrorStatus(S, error message); return; MyDrv-StartScan(); #endif /* MDL_START */* Function: mdlOutputs = * Abstract: * In this function, you compute the outputs of your S-function * block. Generally outputs are placed in the output vector, ssGetY(S). */static void mdlOutputs(SimStruct *S, i

18、nt_T tid) /const real_T *u = (const real_T*) ssGetInputPortSignal(S,0); real_T *y = ssGetOutputPortRealSignal(S,0); real_T val,Sampletime; P1202DRV *MyDrv = (P1202DRV *)ssGetPWork(S)0; Sampletime=ssGetT(S); val=MyDrv-Read(Sampletime); if(val100.0) ssSetErrorStatus(S, Data overflow!); y0=val; #define

19、 MDL_UPDATE /* Change to #undef to remove function */#undef MDL_UPDATE#if defined(MDL_UPDATE) /* Function: mdlUpdate = * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any task

20、s that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) #endif /* MDL_UPDATE */#define MDL_DERIVATIVES /* Change to #undef to remove function */#undef MDL_DERIVATIVES#if defined(MDL_DERIVATIVES) /* Function: mdlDerivatives = * Abstract: * In this

21、function, you compute the S-function blocks derivatives. * The derivatives are placed in the derivative vector, ssGetdX(S). */ static void mdlDerivatives(SimStruct *S) #endif /* MDL_DERIVATIVES */* Function: mdlTerminate = * Abstract: * In this function, you should perform any actions that are neces

22、sary * at the termination of a simulation. For example, if memory was * allocated in mdlStart, this is the place to free it. */static void mdlTerminate(SimStruct *S) P1202DRV *MyDrv = (P1202DRV *)ssGetPWork(S)0; if(MyDrv=NULL) return; MyDrv-Stop(); MyDrv-Close(); delete MyDrv; return;/*=* * See sfun

23、tmpl_doc.c for the optional S-function methods * *=*/*=* * Required S-function trailer * *=*/#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a MEX-file? */#include simulink.c /* MEX-file interface mechanism */#else#include cg_sfun.h /* Code generation registration function */#endif#ifdef _c

24、plusplus / end of extern C scope#endifP1202DRV.H:/ P1202DRV.h: interface for the P1202DRV class./#if !defined(AFX_P1202DRV_H_455B5152_0FD1_4D8F_9BD3_9DFD0C69E6E7_INCLUDED_)#define AFX_P1202DRV_H_455B5152_0FD1_4D8F_9BD3_9DFD0C69E6E7_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000#define

25、BUFFLEN 1000#define NUMCHAN 1#define INITFLAG 0X1#define ACTIVEFLAG 0X2#define SCANFLAG 0X4#define READFLAG 0x8#define SAMPLERATE 4000#include #ifdef _cplusplusextern C / use the C fcn-call standard for all functions #endif / defined within this scope #define S_FUNCTION_LEVEL 2#define S_FUNCTION_NAM

26、E test_matlab#include simstruc.h#ifdef _cplusplus / end of extern C scope#endifclass P1202DRV int initflag,buffindex,readcount; int ErrorFlag; time_T Ts,StartTime,EndTime; DWORD dwP1,dwP2; WORD wChannelStatus32,wChannelConfig32,wStatus; WORD wCard0Buf0BUFFLEN*32,wCard0Buf1BUFFLEN*32;public: P1202DRV(); virtual P1202DRV();public: int Init(); int Close(); int StartScan(); double Read(time_T SampleTime); int Stop(); WORD CardRead();#endif / !defined(AFX_P1202DRV_H_455B5152_0FD1_4D8F_9BD3_9DFD0C69E6E7_INCLUDED_)P1202DRV.C:/ P1202DRV.cpp: implementation of the P1202DRV class./

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1