新搞的可变主振
以下为vhdl和仿真波形,可用于电加工领域。或其他需要脉冲的地方。
本来打算用在打0.05mm小孔的机器上,但是机械设计延后。线路的设计
也有很多改善的地方,特别是高速的击穿检测和主轴的伺服刚性多是
需要改善的地方。因为他是一次加工的。没有余量。
另外我也准备把光洁度这个指标提高一个等级,至少要到1.0以下
最好是ra0.8以下。但是取决的因素太多,还没综合综合考虑。可能
根本做不到。
缺点就是用了16bit的数据线传输ton和toff的数据,准备简化为8bit
加上数据选择信号,刚试过不成功。正在烦恼找问题翻书和发帖,但是
好像没有人理我。大概我太菜,别人对我的初级为问题不感兴趣。
论坛内有没有学习dsp和cpld的兄弟 大家可以一起交流交流。
总觉得一个人学习挺艰难的,特别是dsp上的问题。大家一起学习起来
也快,也不寂寞了。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity mosc is
generic( duty:integer:=266
);
port(clk:in std_logic;
plus :out std_logic;
datah:in std_logic_vector(7 downto 0);
datal:in std_logic_vector(7 downto 0);
ld :in std_logic;
ent :in std_logic
);
end mosc;
architecture mosc1 of mosc is
signal cunton :integer range 0 to duty-1;
signal cuntoff :integer range 0 to duty-1;
signal flg :integer range 0 to 1;
signal on_temp :integer range 0 to duty-1;
signal off_temp:integer range 0 to duty-1;
signal ph :integer range 0 to duty-1;
signal pl :integer range 0 to duty-1;
begin
process(clk )
begin
ph<=conv_integer(datah);
pl<=conv_integer(datal);
if rising_edge(clk) then
if cunton<255 and flg=1 and ent=Ƈ' then
plus<=Ƈ'
flg<=1;
cunton<=cunton+1;
elsif cunton=255 and flg=1 and ent=Ƈ'then
cunton<=ph;
flg<=0;
plus<=Ɔ'
elsif cuntoff<255 and flg=0 and ent=Ƈ'then
cuntoff<=cuntoff+1;
plus<=Ɔ'
else
plus<=Ƈ'
flg<=1;
cuntoff<=pl;
end if;
end if;
end process;
end mosc1;