简易地铁自动售票系统设计方案

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \ when others => null ; end case; end process; process(Changeout) --找零金额数码管显示 begin case Changeout is when \when \when \when \when \when \when \when \when \when \when others => null ; end case; end process; process(Toutnum) --出票数量数码管显示 begin case Toutnum is when \when \when \ when \when others => null ; end case; end process; ----------------以上为数码管显示程序模块---------- process(clk_tmp,restart) --下载时候所用时钟频率 --process(clk,restart) --仿真时候所用时钟频率 variable next_state: TT; variable Tm: integer range 0 to 6; -- 车票单价 variable totalmoney,castmoney,restmoney: integer range 0 to 27; -- 车票总额,投币总额,找零总额 variable num : integer range 0 to 3; -- 所购票数 variable empty:std_logic; -- 找零结束标志 begin if (clk_tmp 'event and clk_tmp='1') then --下载时候所用时钟频率 -- if (clk_tmp 'event and clk_tmp='1') then--仿真时候所用时钟频率 State<=\系统等待状态 if Restart='1' then -------------以下为系统复位初始化-------------- Tout<='0'; Mout<=\ MoneyInputAlarm<='0'; totalmoney:=0; castmoney:=0; restmoney:=0; Tstyle <=\数码管显示0 Tnumber <=\数码管显示0 Minput<=\数码管显示0 Toutnum<=\数码管显示0 Changeout<=\数码管显示0 -------------以上为系统复位初始化-------------- next_state:=selstyle; -- 系统复位,回到初始选站状态 else case next_state is when selstyle => -- 选择出票种 case style is -- 共3种车票类型 when \ Tstyle <=\代表未选择 when \Tstyle <=\代表选择单价2元车票 when \Tstyle <=\代表选择单价2元车票 when \Tstyle <=\代表选择单价2元车票 when others =>null; end case; if Tm/=0 then next_state := selticket; -- 选票种结束,进入选票数状态 else next_state := selstyle; -- 未选票种,停留在选票种状态 end if ; when selticket => -- 选择票数 State<=\等待选择购票数量状态 if (Cancelkey='1') then next_state:=givechange;-- 选票期间取消操作,直接进入找零状态 else case Tnum is when \代表选择1张车票 totalmoney := totalmoney+ 1*Tm; -- 计算票价 num:=1;

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4