程控用户摘挂机检测仿真实验

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

程控用户摘/挂机扫描监视识别实验一、实验目的(1)掌握用户摘挂机原理。(2)熟悉MATLAB仿真软件的使用。二、实验内容(1)编写MATLAB程序仿真用户摘挂机程序。(2)观察本次(当前)扫描结果。(3)观察前次扫描结果。(4)观察用户摘挂机的逻辑运算结果。(5)分析仿真中观察的数据,撰写实验报告。三、实验原理由于用户线的状态变化是随机的,因此处理机要对用户线的状态作周期性的监视。那么,扫描周期应该是多少呢?理论证明,摘/挂机识别的扫描周期在100~200ms之间较为合适,因为周期过短会使处理机工作过于频繁,而周期过长又不能及时捕捉到摘/挂机信息。实际应用中常取200ms为摘/挂机识别的扫描周期,即处理机每隔200ms对所有用户线扫描1次。识别主叫摘机的逻辑运算式为识别用户挂机的逻辑运算式为式中:SCN——扫描存储器,存储本次(当前)扫描结果;LM——用户存储器,存储前次扫描结果。程控交换机用户摘挂机检测SCN——扫描存储器,存储本次(当前)扫描结果;LM——用户存储器,存储前次扫描结果。设D8D7D6D5D4D3D2D1SCN10000010LM01100001编程计算并画出SCNLM波形图四、实验步骤(1)预习用户摘挂机原理(2)根据系统方框图,画出仿真流程图。(3)编写MATLAB程序并上机调试。(4)观察SCNLM波形图。(5)撰写实验报告。五、摘/挂机识别程序流程图如图LMSCNLMSCNLMSCNLMSCNLMSCNLMSCN1LMSCN1LMSCN六、MATLAB程序#includestdio.h#includeconio.h#includedos.h#defineFIRST_BOARD_HOOK_ADDRESS0x260#defineOFFHOOK_QUEUE_SIZE16#defineONHOOK_QUEUE_SIZE16#defineSUM_BOARD_3inti;unsignedcharUM_offhook;unsignedcharLm[1];unsignedcharSubs_Bit[8];unsignedcharOffHook_Queue[OFFHOOK_QUEUE_SIZE];unsignedcharOffHook_Spos,OffHook_Rpos,OffHook_Queue_Flag;unsingedcharOnHook_Queue[ONHOOK_QUEUE_SIZE];unsignedcharOnHook_Spos,OnHook_Rpos,OnHook_Queue_Flag;unsignedcharUM_OffHook_1,UM_OnHook_1;voidScanFirstBoard(void);main()OffHook_Queue[0]=0;OffHook_Spos=0;OffHook_Rpos=0;OffHook_Queue_Flag=0;OnHook_Queue[0]=0;OnHook_Spos=0;OnHook_Rpos=0;OnHook_Queue_Flag=0;Lm[0]=0;Subs_Bit[0]=0x01;Subs_Bit[1]=0x02;Subs_Bit[2]=0x04;Subs_Bit[3]=0x08;Subs_Bit[4]=0x10;Subs_Bit[5]=0x20;Subs_Bit[6]=0x40;Subs_Bit[7]=0x80;UM_OffHook_1=0;UM_OnHook_1=0;Outportb(0x369,0);clrscr();printf(“Pleaseoffhook,checkoffhooksubscribernumber.\n”);printf(“Thenonhook,checkonhooksubscribernumber.\n”);for(;;){If(kbhir())Break;Delay(20);ScanFirstBoard();}Return0;}VoidScanFirstBoard(){unsignedcharScn;unsignedcharNewScan_OffHook;unsignedcharNewScan_OnHook;unsignedcharOldLm;unsignedcharCurrentBoardNum;unsignedintJudgeWord;inti;CurrentBoardNum=0x01;Scn=inportb(FIRSR_BOARD_HOOK-ADDRESS)&0xff;JudgeWord=UM_OffHook_1&Scn;i=7;while(JudgeWord!=0){While((JudgeWord&Subs_Bir[i])!=Subs_Bit[i])i--;if(((OffHook_Spos+1)==OffHook_Rpos)||((OffHook_Spos==OFFHOOK_QUEUE_SIZE)&&(OffHook_Spos==0))){Printf(“OffHook_QueueisFull.NotInsert.\n”);}Else{OffHook_Queue[OffHook_Spos]=i;printf(“OffHook_Queue:BoardNum:%d,OffHook_Sub:%d\n”,CurrentBoardNum,i+1);}JudgeWord=JudgeWord&(~Subs_Bit[i]);i--;}printf(“OffHook_Queue:%x\n”,OffHook_Queue[OffHook_Spos]);NewScan_OffHook=Scn;OldLm=Lm[0];UM_OffHook_1=NewScan_OffHook&(~OldLm);NewScan_OnHook=Scn;JudgeWord=UM_OnHook_1&(~NewScan_OnHook);i=7;while(JudgeWord!=0){While((JudgeWord&Subs_Bit[i])!=Subs_Bit[i]i--;if(((OnHook_Spos+1)==OnHook_Rpos)||((OnHook_Spos==ONHOOK_QUEUE_SIZE)&&(OnHook_Rpos==0))){Printf(“OnHook_QueueisFull.NotInsert.\n”);}else{OnHook_Queue[OnHook_Spos]=i;printf(“OnHook_Queue:%d,OnHook_Sub:%d\n”,}JudgeWord=JudgeWord&(~Subs_Bit[i]);i--;}NewScan_OnHook=Scn;OldLm=Lm[0];UM_OnHook_1=(~NesScan_OnHook)&OldLm;Lm[0]=Scn;}七、仿真图八、波形分析从仿真的波形图形可以看出来,当scn=1,lm=0时,F=0,k=0;当scn=0,lm=1时,F=1,k=1;当scn=0,lm=0时,F=0,k=0;此结果符合识别主叫摘机的逻辑运算式,与识别用户挂机的逻辑运算式。1LMSCN1LMSCN

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功