Easy HDL应用
发布时间:2016/4/19 20:50:44 访问次数:1165
1)产生三角波
用EaSy HDL脚本编写一NCP3985SN30T1G个模拟三角波信号源,如图7-41所示(配套电子资源实例为chap7中的Triangle Wave. pdsprj)。
图7-41 Easy HDL脚本实现三角波信号源
Easy HDL脚本如下:
REM TRIANGLE WAVE GENERATOR
REM Define the Waveform Parameters
FLOAT FREQ=100, AMP=2, SLOPE-1
FLOAT PERIOD=1/FREQ,OFFSET=O
REM Repeating event for positive slope
ON TIMER AT PERIOD EVERY PERIOD
OFFSET--EVTTIME
SLOPE=1
ENDON
REM Repeating event for negative slope
ON TIMER AT PERIOD/2 EVERY PERIOD
OFFSET=EVTTIME
SLOPE= - 1
ENDON
REM Set the output as a function of both time
REM and the current waveform slope
OUT=AMP* SLOPE*(4*(REALTIME- OFFSET) /PERIOD-1)
1)产生三角波
用EaSy HDL脚本编写一NCP3985SN30T1G个模拟三角波信号源,如图7-41所示(配套电子资源实例为chap7中的Triangle Wave. pdsprj)。
图7-41 Easy HDL脚本实现三角波信号源
Easy HDL脚本如下:
REM TRIANGLE WAVE GENERATOR
REM Define the Waveform Parameters
FLOAT FREQ=100, AMP=2, SLOPE-1
FLOAT PERIOD=1/FREQ,OFFSET=O
REM Repeating event for positive slope
ON TIMER AT PERIOD EVERY PERIOD
OFFSET--EVTTIME
SLOPE=1
ENDON
REM Repeating event for negative slope
ON TIMER AT PERIOD/2 EVERY PERIOD
OFFSET=EVTTIME
SLOPE= - 1
ENDON
REM Set the output as a function of both time
REM and the current waveform slope
OUT=AMP* SLOPE*(4*(REALTIME- OFFSET) /PERIOD-1)
上一篇:搽 针