数电研讨---医用生产线设计报告.docx_第1页
数电研讨---医用生产线设计报告.docx_第2页
数电研讨---医用生产线设计报告.docx_第3页
数电研讨---医用生产线设计报告.docx_第4页
数电研讨---医用生产线设计报告.docx_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

PROJECT REPORT实验课程: 数字电路EDA实验实验名称: 医用生产线【Requirement】Be able to preset the number of tablets per bottle, for example ,fifty tablets each bottle. Every box contains twenty-four bottles, stop count until 18 Use software to design the simulation, Quartus II will be better. 【Principle and framework given by teacher】【Our system framework】【1.0】【2.0】【Modular design and simulation】Keyboard prcessor【Function introduction】 As project requirement, we can optional set keyboard size and what is the key arrangement. However , in consideration of engineering application, we chose 4*4 keyboard , as indicated below.Just as the picture illustrated above, We define “A” are the first counter enable pin .When the A pin is high , corresponding counter accept 8-bit number as its period. So as B and C.D is the reset put which clear the number of register. *and # are use as back-up. Basic on this keyboard framework we can easily achieve our program use VHDL.At first ,we divide the keyboard into a 4 row and 4 column and then judge its value using case sentence.【Programming】LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY KEYBOARD IS PORT(CLK: IN STD_LOGIC;ROW: IN STD_LOGIC_VECTOR(3 DOWNTO 0); /行向量COL: IN STD_LOGIC_VECTOR(3 DOWNTO 0); /列向量DATA: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);F:OUT STD_LOGIC; /给寄存器判断是否有输入EN1: OUT STD_LOGIC;EN2: OUT STD_LOGIC;EN3: OUT STD_LOGIC);END ENTITY KEYBOARD;ARCHITECTURE RTL OF KEYBOARD ISSIGNAL MID: STD_LOGIC_VECTOR(7 DOWNTO 0);SIGNAL NUM: STD_LOGIC_VECTOR(3 DOWNTO 0);BEGINPROCESS(CLK,ROW,COL)BEGINMID NUM NUM NUM NUM NUM NUM NUM NUM NUM NUM NUM=1010;EN1=0;EN2=0;EN3 NUM=1111;EN1=1;EN2=0;EN3 NUM=1111;EN1=0;EN2=1;EN3 NUM=1111;EN1=0;EN2=0;EN3 NUM=1111;/1111的时候表示数据无效END CASE;END IF;DATA=NUM;F=(NUM(0) AND NUM(1) AND NUM(2) AND NUM(3);END PROCESS;END RTL;【Simulation waveform】Register【Function introduction】 This register has 4-bit input and 8-bit output, and a input named “carry” is also add to this register . When carry equal to “1”, put the 4-bit input to high output pin, when the other, the 4-bit input will be put into low output pin.【programming】LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY REGISTER_DIY IS PORT(F: IN STD_LOGIC;CLK: IN STD_LOGIC;CARRY : IN STD_LOGIC;RIN: IN STD_LOGIC_VECTOR(3 DOWNTO 0);OUT_LOW: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);OUT_HIGH: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);END REGISTER_DIY;ARCHITECTURE RTL OF REGISTER_DIY IS SIGNAL F_IN: STD_LOGIC_VECTOR(1 DOWNTO 0);BEGIN PROCESS(CLK,F,CARRY)BEGIN F_IN OUT_LOW OUT_HIGH NULL;END CASE;END IF;END PROCESS;END RTL;【Simulation waveform】BCD to binary convertorAt the very beginning, we should ask a question to ourselves. Why we need a BCD to binary converter? We use the keyboard to put in the number of pills per bottle which is from 0 to 99, it is BCD, but the counter only counts the binary number, so we need to convert the BCD to binary numbers.【Function introduction】At First, we divide the BCD into high bit and low bit, then use two registers to store them and convert high bit and low bit respectively. When we convert the high bit, we assume the low bit is zero, then convert the BCD with low bit zero to binary numbers. For example,0010(high bit) 00100000(BCD) 00010100(binary)Then we convert the low bit, similarly, we assume the high bit is zero, and then convert the BCD with high bit zero to binary numbers. For example,0010(low bit) 00000010(BCD) 00000010(binary)Finally, we need an adder to add the two binary numbers(high bit and low bit) to get the final binary numbers. Then we have finished BCD to binary conversion.00100010(BCD) 00010100(high bit)+00000010(low bit) 00010110(binary number)【Programming】【BCD to binary (high-bit)】library IEEE; use IEEE.std_logic_1164.all; entity BCD_binary_high is port ( CLK : IN STD_LOGIC; BCD_high: in bit_vector(3 downto 0); binary_high:out bit_vector(7 downto 0); end BCD_binary_high; architecture RTL of BCD_binary_high is begin process(BCD_high,CLK) begin IF CLKEVENT AND CLK=1 THEN case BCD_high is when 0000 = binary_high binary_high binary_high binary_high binary_high binary_high binary_high binary_high binary_high binary_high binary_high binary_low binary_low binary_low binary_low binary_low binary_low binary_low binary_low binary_low binary_low binary_low=01000000; end case; end process; end RTL;【Simulation waveform】Figure 1 BCD to binary converter(high-bit)Figure 2BCD to binary converter(low-bit)Adder【Function introduction】we need an adder to add the two binary numbers(high bit and low bit) to get the final binary numbers. Then we have finished BCD to binary conversion.【Programming】library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity Unsigned_adder is port ( A,B: in std_logic_vector(7 downto 0); S: out std_logic_vector (7 downto 0); end Unsigned_adder ; architecture RTL of Unsigned_adder is begin S=A + B; end RTL;【Simulation waveform】Simulate successfully achieved the function of adder, but it has some delay and interference. I think it may caused by Race and Hazard.Counter【Function introduction】Set D and Q as the signal variable .D resource from the key board .Q is the internal signal of counter ,it circulates upon D.Once D has been settle ,Q is upcount for D times.When Q run for D times, Theres a OUTPUT pulse through Cd .One circulation end.【Programming】library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity bc3 is port(CLK:in std_logic; D:IN std_logic_vector(7 downto 0); Q:buffer std_logic_vector(7 downto 0); Cd:out std_logic;EN:in std_logic); end; architecture ONE of bc3 is begin process(CLK) begin if CLKevent and CLK=1and EN=0then Q=D; if QD-1 then Q=Q+1; else Q=00000000; end if

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论