matlab,simulink驱动程序篇之分频器设计
并在其基础上进行修改、设计。
1、 以下设计用到最主要的模型是Subsystem,分频器顶层设计面板如图1所示:

图1 分频器顶层设计面板
面板设计具体步骤:
a) 点击右键
b) 出现以下Mask Editor窗口。如表1进行设计。
表1 Mask Editor窗口设计
c) 以上设计,得到图2设计面板:
图2 subsystem设计面板
2、 分频器设计采用自上而下的设计思路。
a) Subsystem结构:这里用到了Triggerd Subsystem,上升沿、下降沿同时触发(either)。

图3 Subsystem结构
b) Triggered Subsystem结构:这里用到了Unit Delay,用于采集上升沿、下降沿信号,并通过add加1。

图4 Triggered Subsystem结构
c) Triggered Subsystem\Subsystem结构:

图5 Triggered Subsystem\Subsystem结构
原理:
1) u1记录上升沿和下降沿的个数,最大到N=2*num;
2) 第N个时钟上升沿到来时,u1=N,输出应翻转为0,并令u1=0;
3) Merge负责选择、确定最新的u1。即依次加1的阶梯波形,如图6:

图6 u1的波形
4) 采用Deal Function模块对u1信号进行处理。
Deal Function结构:

图7 Deal Function结构
3、 以上设计,如图2输入参数值后得到图8波形:

图8 分频器输出波形
用户403664 2014-3-17 11:10