毕业设计指导网:毕业设计范文、毕业答辩指导,免费毕业设计、计算机毕业论文参考资料下载服务。

技术团队主要成员为国内著名高校计算机专业导师。诚实守信,优质服务,是我们的宗旨!
当前位置:毕业设计指导网计算机毕业设计频道其他设计

计算机毕业设计自动售货机简介

8.21 计算机毕业设计自动售货机VHDL程序与仿真
(1)自动售货机VHDL程序如下:
--文件名:pl_auto1.vhd。
--功能:货物信息存储,进程控制,硬币处理,余额计算,显示等功能。
--说明:显示的钱数coin的 以5角为单位。
--最后修改日期:2004.3.23。
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_auto1 is
port ( clk:in std_logic;                              --系统时钟
set,get,sel,finish: in std_logic;                   --设定、买、选择、完成信号
coin0,coin1: in std_logic;                      --5角硬币、1元硬币
price,quantity  :in std_logic_vector(3 downto 0);   --价格、数量数据
item0 , act:out std_logic_vector(3 downto 0);       --显示、开关信号
y0,y1 :out std_logic_vector(6 downto 0);          --钱数、商品数量显示数据
act10,act5   :out std_logic);                   --1元硬币、5角硬币
end PL_auto1;
architecture behav of PL_auto1 is
type  ram_type is array(3 downto 0)of std_logic_vector(7 downto 0);
signal ram :ram_type;                                      --定义RAM
signal item: std_logic_vector(1 downto 0);                      --商品种类
signal coin: std_logic_vector(3 downto 0);                      --币数计数器
signal pri,qua:std_logic_vector(3 downto 0);                    --商品单价、数量
signal clk1: std_logic;                                      --控制系统的时钟信号
begin
com:process(set,clk1)
variable quan:std_logic_vector(3 downto 0);
begin
  if set='1' then ram(conv_integer(item))<=price & quantity;act<="0000";
--把商品的单价、数量置入到RAM
  elsif clk1'event and clk1='1' then  act5<='0'; act10<='0';
      if coin0='1' then    
      if coin<"1001"then coin<=coin+1;            --投入5角硬币,coin自加1
   else coin<="0000";
   end if;
      elsif coin1='1' then
   if coin<"1001"then coin<=coin+2;            --投入1元硬币,coin自加2
   else coin<="0000";
   end if;
      elsif sel='1' then item<=item+1;                  --对商品进行循环选择
elsif get='1' then                              --对商品进行购买
if qua>"0000" and coin>=pri then coin<=coin-pri;quan:=quan-1;
ram(conv_integer(item))<=pri & quan;
            if   item="00" then act<="1000";  --购买时,自动售货机对4种商品的操作
   elsif item="01" then act<="0100";
      elsif item="10" then act<="0010";
      elsif item="11" then act<="0001";
   end if;计算机毕业设计
  

计算机毕业设计说明

本论文出自毕业设计指导网http://www.bysj120.cn,为保证客户隐私本站的成品计算机毕业设计一律不在网站上刊登任何程序截图、毕业论文目录摘要等。如需详细了解设计具体内容请联系本站在线客服索取的程序运行演示、毕业论文介绍。网站上展示的只是部分成品设计,如找不到您需要的毕业设计请联系在线客服查询。

在线客服

  • 咨询QQ:
  • 407894958
  • 点击和客服QQ在线沟通
  • 点击和客服QQ在线沟通
  • 成品购买:
  • 定制咨询:
  • 点击和客服QQ在线沟通
  • 点击和客服QQ在线沟通
  • 如临时会话消息无法接收 请先加客服QQ好友咨询
    微信客服

计算机毕业设计,免费毕业论文,优秀毕业设计论文下载


120毕业设计指导网
地址:徐州市西安路41号
收缩
  • 计算机毕业设计定做咨询