report- vhdl tachometer

28

Upload: shaunak-de

Post on 07-Apr-2015

887 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Report- VHDL Tachometer
Page 2: Report- VHDL Tachometer

Table of ContentsTachometer.................................................................................................................................................3

Introduction.............................................................................................................................3Need for a Tachometer............................................................................................................3

Abstract......................................................................................................................................................5Research Focus........................................................................................................................5Issue(s) Addressed...................................................................................................................5Research Method.....................................................................................................................5Conclusions and Recommendations........................................................................................5

Operation..........................................................................................................................................6RPM transducer.......................................................................................................................6Clock Generator......................................................................................................................6Digital To Analog Converter...................................................................................................7Pointer.....................................................................................................................................7

RTL Schematic...........................................................................................................................................8CLOCKDIV............................................................................................................................8TMETER.................................................................................................................................8

VHDL Code...............................................................................................................................................9System..............................................................................................................................................9

CLKDIV...................................................................................................................................................11TMETER..................................................................................................................................................12VHDL Simulation....................................................................................................................................14

System Overview..................................................................................................................15System Detail -1....................................................................................................................16System Detail -2....................................................................................................................17Reset Action..........................................................................................................................18CLKDIV................................................................................................................................19TMETER...............................................................................................................................20

Implementation Report............................................................................................................................21CPLD Fitter Report...............................................................................................................21Resources summary...............................................................................................................21Pin resources.........................................................................................................................21Global resources....................................................................................................................21Power Data............................................................................................................................21

Inputs........................................................................................................................................................22Function Blocks.......................................................................................................................................22Compiler Options.....................................................................................................................................22Pin List.....................................................................................................................................................23Implementation Diagram.........................................................................................................................25Conclusions..............................................................................................................................................26Bibliography.............................................................................................................................................27

Page 3: Report- VHDL Tachometer

Tachometer

Introduction

A tachometer (also called a revolution-counter, "Tach", rev-counter, or RPM gauge) is an instrument that measures the rotation speed of a shaft or disk, as in a motor or other machine. The device usually displays the revolutions per minute (RPM) on a calibrated analogue dial, but digital displays are increasingly common. The term comes from Greek Ταχος,, "speed", and metron, "to measure".

Need for a Tachometer

Tachometers or rev counters on automobiles, aircraft, and other vehicles show the rate of rotation of the engine's crankshaft, and typically have markings indicating a safe range of rotation speeds. This can assist the driver in selecting appropriate throttle and gear settings for the driving conditions. Prolonged use at high speeds may cause inadequate lubrication, overheating (exceeding capability of the cooling system), exceeding speed capability of sub-parts of the engine (for example spring retracted valves) thus causing excessive wear or permanent damage or failure of engines.

On analogue tachometers, speeds above maximum safe operating speed are typically indicated by an area of the gauge marked in red, giving rise to the expression of "redlining" an engine — revving the engine up to the maximum safe limit.

In vehicles such as tractors and trucks, the tachometer often has other markings, usually a green arc showing the speed range in which the engine produces maximum

Illustration 1: Automobile Tachometer

Page 4: Report- VHDL Tachometer

torque, which is of prime interest to operators of such vehicles. Tractors fitted with a power take off (PTO) system have tachometers showing the engine speed needed to rotate the PTO at the standardized speed required by most PTO-driven implements. In many countries, tractors are required to have a speedometer for use on a road. To save fitting a second dial, the vehicle's tachometer is often marked with a second scale in units of speed. This scale is only accurate in a certain gear, but since many tractors only have one gear that is practical for use on-road, this is sufficient. Tractors with multiple 'road gears' often have tachometers with more than one speed scale. Aircraft tachometers have a green arc showing the engine's designed cruising speed range.

A tachometer is vital is preventing engine over-speed.

Overspeed is a condition in which an engine is allowed or forced to turn beyond its design limit. The consequences of running an engine too fast vary by engine type and model and depend upon several factors, chief amongst them the duration of the overspeed and by the speed attained. With some engines even a momentary overspeed can result in greatly reduced engine life or even catastrophic failure. The speed of an engine is ordinarily measured in revolutions per minute (RPM).

Typical maximal RPMs of performance engines are provided in the following table:

Automobile Maximum Engine Speed

Audi R8 V8 8000 rpm

Audi Q7 6.0 V12 diesel 4750 rpm

Bugatti Veyron turbocharged W16 6500 rpm

Honda S2000 I4 8200 rpm

Lexus LFA V10 9000 rpm

Volkswagen Golf GTI 2.0TSI I4 6500 rpm

Nissan GTR turbocharged V6 7000 rpm

Ferrari Enzo V12 8000 rpm

Table 1: Typical Engine Speed Ratings

As an example of what a tachometer can be used for, think of driving a car up a hill. By watching the tachometer, you will know if you should shift gears. This gives a visual cue to help you drive your car in the most efficient manner.

Thus a tachometer is a vital instrument which allows a vehicle operator to select the correct gear for maximum efficiency and performance, and allows him or her to operate the engine within safe parameters.

Page 5: Report- VHDL Tachometer

Abstract

Research Focus

The objective of this project is to design, implement, simulate and synthesize the logic required for the operations of a Tachometer. The prime focus of the design was to match the accuracy and reliability of analog tachometers, while at the same time reducing cost of the instrument by minimizing mechanical parts. The output is to be obtained by driving a mechanical pointer, since it is more convenient to read during driving.

Issue(s) Addressed

Two constraints were kept in mind during the design of the circuit. First, the design was to have the maximum possible clock speed, in order for the precision of the device not to be sacrifices. The second, to minimize cost, the design was to be fitted inside a CPLD with 108 macrocells1.

During simulation, propagation delays in the internal latches were reducing the speed of operation. This issue was resolved by splitting the design internally into multiple blocks.

The timing generation was derived internally by dividing a 10Mhz clock and setting up a PWM2, in a block separate from the counter to enhance customizable and reduce the need for external components.

Research Method

The design was described in VHDL3 and compiled and simulated in ModelSim III XE. It was then implemented in Xilinx ISE Project Navigator and was targeted on an Automotive XC95108. Synthesis and Fitting of the logic was then carried out. The Automotive part was chosen for its higher reliability.

Conclusions and Recommendations

The design was successfully synthesized on a XC95108 CPLD with a maximum possible clock of 83.33 Mhz. We found that by targeting a newer device like the CoolRunner2, the clock speed may be increased to 140+ Mhz, using the same design.

1 A macrocell array is a prefabricated array of higher-level logic functions such as flip-flops, ALU functions, registers etc.2 PWM = Pulse Width Modulation3 VHSIC hardware description language. VHSIC: very-high-speed integrated circuit

Page 6: Report- VHDL Tachometer

OperationThe block diagram of the system is shown below:

The main components of the system are:

1. RPM Transducer

2. Clock Generator

3. Digital to Analog convertor

4. Pointer Display

RPM transducer

A contactless ferromagnetic sensor can be used to measure the spinning speed of the engine without causing frictional losses. The RPM Transducer PR 9376 is ideally suited for such measurement. Due to high resolution, fast internal electronic and the sharp edged output pulses the PR 9376 is suitable for measurement of extremely high as well as very low rotational speeds with high resolution.

Clock Generator

The CDCS502 is a spread spectrum capable, fundamental mode crystal oscillator with selectable frequency multiplication. It features an advanced gain controlled fundamental mode crystal oscillator stage with a built-in load capacitance of 10pF. This oscillator stage accepts crystals from 8MHz to 32MHz with an ESR of up to 180 Ω . The stage can be used with crystals with power dissipation of 50 µ W and up. The input signal is processed by a PLL, whose output frequency is either equal to the input frequency or multiplied by the factor of 4, depending on the mode selected.

Page 7: Report- VHDL Tachometer

Digital To Analog Converter

The AD5543/AD5553 are precision 16-/14-bit, low power, current output, small form factor digital-to-analog converters (DACs). They are designed to operate from a single 5 V supply with a ±10 V multiplying reference. The applied external reference, VREF, determines the full-scale output current. An internal feedback resistor (RFB) facilitates the R-2R and temperature tracking for voltage conversion when combined with an external op amp. These can accurately convert the digital output to drive the pointer.

Pointer

A galvanometer may be used for displaying the reading to the vehicle operator. A galvanometer is a type of ammeter: an instrument for detecting and measuring electric current. It is an analog electromechanical transducer4 that produces a rotary deflection of some type of pointer in response to electric current flowing through its coil. The term has expanded to include uses of the same mechanism in recording, positioning, and servomechanism equipment.

A analog meter is preferred because it is easier for a vehicle operator to read while driving the machine.

4 transducer is a device that converts one type of energy to another.

Illustration 2: Galvanometer

Page 8: Report- VHDL Tachometer

RTL Schematic

The system consists of two main sub-circuits.

1. CLOCKDIV

2. TMETER

CLOCKDIV

It divides the master CLOCK signal such that a pulse of 80% duty cycle and adequate duration is setup up. By modifying this block the device can be made to measure faster or slower spin speeds.

TMETER

This consists of a 16 bit counter, gating and auto-reset logic. This counts the rotations per gate pulse and outputs the result on the RESULT [0:15] bus. That in turn drives a DAC and hence the pointer.

Illustration 3: Entity Diagram

Page 9: Report- VHDL Tachometer

VHDL Code

System

-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~-- _____ _ _ -- |_ _|_ _ ___| |__ ___ _ __ ___ ___| |_ ___ _ __ -- | |/ _` |/ __| '_ \ / _ \| '_ ` _ \ / _ \ __/ _ \ '__|-- | | (_| | (__| | | | (_) | | | | | | __/ || __/ | -- |_|\__,_|\___|_| |_|\___/|_| |_| |_|\___|\__\___|_| ---- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~-- +-+-+-+-+-+-+-+ +-+-+ +-+-+-+ +-+-+-+-+-+-+ +-+-+-- |S|h|a|u|n|a|k| |D|e| |a|n|d| |N|i|k|h|i|l| |A|.|-- +-+-+-+-+-+-+-+ +-+-+ +-+-+-+ +-+-+-+-+-+-+ +-+-+

-- VHDL Code to ganetare timing, control logig and-- measure RPM of an rotating part. eg: Engine.---- The Ports are as follows:-- INPUT: CLOCK, MOTORIN, RST-- OUTPUT: RESULT---- 15 OCT 2010, V1.1-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_ARITH.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY SYSTEM IS PORT( CLOCK: IN STD_LOGIC; MOTORIN: IN STD_LOGIC; RST: IN STD_LOGIC; RESULT: OUT INTEGER RANGE 0 TO 65535 );END SYSTEM;

ARCHITECTURE SYS OF SYSTEM IS COMPONENT TMETER IS PORT( GATE: IN STD_LOGIC; -- MASTER

MOTOR: IN STD_LOGIC;RESET : IN STD_LOGIC;

Page 10: Report- VHDL Tachometer

SSD: OUT INTEGER RANGE 0 TO 65535);

END COMPONENT;

COMPONENT CLKDIV IS PORT( CLK: IN STD_LOGIC; CLKOUT: OUT STD_LOGIC ); END COMPONENT;

SIGNAL CLKTRN: STD_LOGIC; BEGIN CLOCKDIV: CLKDIV PORT MAP (CLK=>CLOCK, CLKOUT=>CLKTRN); TACHMETER: TMETER PORT MAP (GATE=>CLKTRN, MOTOR=>MOTORIN, RESET => RST, SSD=>RESULT); END SYS;

Page 11: Report- VHDL Tachometer

CLKDIV-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~-- Entity to set up PWM pulses and divide master clock.-- Ports of the entity are as follows:-- IN: CLK -- OUT: CLKOUT-- 15 OCT 2010, V1.1-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_ARITH.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY CLKDIV IS PORT( CLK: IN STD_LOGIC; CLKOUT: OUT STD_LOGIC );END CLKDIV;

ARCHITECTURE DIV OF CLKDIV IS BEGIN

PROCESS (CLK) VARIABLE COUNT: INTEGER RANGE 0 TO 12501 :=0; VARIABLE STATE: STD_LOGIC := '1'; BEGIN IF(CLK'EVENT and CLK='1') THEN -- SET UP COUNTER IF(COUNT=12500)THEN COUNT:=0; STATE:= '1'; ELSE COUNT := COUNT+1; END IF; IF(COUNT=10000)THEN -- SET UP PWM STATE:= NOT STATE; END IF; END IF; CLKOUT <= STATE; END PROCESS;END DIV;

Page 12: Report- VHDL Tachometer

TMETER-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~-- Entity to count gated pulses and auto reset.---- Ports of the entity are as follows:-- IN: GATE, MOTOR, RESET -- OUT: SSD---- 15 OCT 2010, V1.1-- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_ARITH.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY TMETER IS PORT( GATE: IN STD_LOGIC; -- ENABLE GATE

MOTOR: IN STD_LOGIC; -- COUNTER CLOCK

RESET : IN STD_LOGIC; -- ASYNC RESET

SSD: OUT INTEGER RANGE 0 TO 65535 -- OUTPUT);

END TMETER;

ARCHITECTURE TACH OF TMETER IS BEGIN

PROCESS (MOTOR, GATE, RESET)

VARIABLE N:INTEGER RANGE 0 TO 65535 := 0;

BEGIN

IF GATE='1' AND GATE'EVENT THEN -- AUTO RESET SYSTEM ON GATE ROLL

N := 0;END IF;

IF N=65535 THEN N := 0;END IF;

IF MOTOR='1' AND GATE='1' THEN -- COUNT MOTOR TICKS

N := N+1;END IF;

Page 13: Report- VHDL Tachometer

IF GATE='0' THEN -- LATCH COUNT TO OUTPUT LINES

SSD <= N;END IF;

IF RESET='1' THEN -- ASYNC RESET LOGIC

N:=0;SSD <=N;END IF;

END PROCESS;

END TACH;

Page 14: Report- VHDL Tachometer

VHDL SimulationVHDL code attached above was compiled and simulated in ModelSim XE III (Started

Edition).

Simulation was with a 100 picoseconds clock. The results were then split into various different timescales to allow observations on all features of the circuit.

The circuit was implemented in ISE Project Navigator 12.2

The results of the simulation and Implementation reports are attached ahead.

Illustration 4: Simulation in ModelSim

Page 15: Report- VHDL Tachometer

System Overview

Page 16: Report- VHDL Tachometer

System Detail -1

Page 17: Report- VHDL Tachometer

System Detail -2

Page 18: Report- VHDL Tachometer

Reset Action

Page 19: Report- VHDL Tachometer

CLKDIV

Page 20: Report- VHDL Tachometer

TMETER

Page 21: Report- VHDL Tachometer

Implementation ReportThe design was implemented in ISE Project Navigator on an Automotive XC95108 device. The result of the implementation are as follows:

CPLD Fitter Report

Design Name SYSTEM

Fitting Status Successful

Software Version M.63c

Device Used XC95108-7-PC84

Date 10-17-2010, 11:55PM

Resources summary

Macrocells Used Pterms Used Registers Used Pins Used Function Block

Inputs Used91/108 (85%) 222/540 (42%) 31/108 (29%) 19/69 (28%) 175/216 (82%)

Pin resources

Signal Type Required MappedInput 2 2Output 16 16Bidirectional 0 0GCK 1 1GTS 0 0GSR 0 0

Global resources

Signal mapped onto global clock net (GCK1) CLOCK

Power Data

Macrocells in high performance mode (MCHP) 91

Macrocells in low power mode (MCLP) 0Total macrocells used (MC) 91

Page 22: Report- VHDL Tachometer

Inputs

Signal Name Function Block

Macrocell

Pin Number

Pin Type

Pin Use

CLOCK FB1 MC12 9 I/O/GCK1 GCK

MOTORIN FB5 MC17 44 I/O IRST FB2 MC3 72 I/O I

Function Blocks

Function Block

Macrocells Used/Total

Function Block Inputs Used/Total

Product Terms Used/Total

Pins Used/Tota

lFB1 12 / 18 27 / 36 24 / 90 1 / 12FB2 16 / 18 32 / 36 42 / 90 4 / 12FB3 16 / 18 32 / 36 47 / 90 4 / 12FB4 16 / 18 32 / 36 43 / 90 4 / 11FB5 15 / 18 32 / 36 39 / 90 3 / 11FB6 16 / 18 20 / 36 27 / 90 2 / 11

Compiler OptionsFollowing is a list of all global compiler options used by the fitter run.

Device(s) Specified : xc95108-7-PC84Optimization Method : DENSITYMulti-Level Logic Optimization : ONIgnore Timing Specifications : OFFDefault Register Power Up Value : LOWKeep User Location Constraints : ONWhat-You-See-Is-What-You-Get : OFFExhaustive Fitting : OFFKeep Unused Inputs : OFFSlew Rate : FASTPower Mode : STDGround on Unused IOs : OFFGlobal Clock Optimization : ONGlobal Set/Reset Optimization : ONGlobal Ouput Enable Optimization : ONFASTConnect/UIM optimzation : ONLocal Feedback : ONPin Feedback : ONInput Limit : 36Pterm Limit : 25

Page 23: Report- VHDL Tachometer

Pin ListDevice : XC95108-7-PC84

-------------------------------------------------------------- /11 10 9 8 7 6 5 4 3 2 1 84 83 82 81 80 79 78 77 76 75 \ | 12 74 | | 13 73 | | 14 72 | | 15 71 | | 16 70 | | 17 69 | | 18 68 | | 19 67 | | 20 66 | | 21 XC95108-7-PC84 65 | | 22 64 | | 23 63 | | 24 62 | | 25 61 | | 26 60 | | 27 59 | | 28 58 | | 29 57 | | 30 56 | | 31 55 | | 32 54 | \ 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 / --------------------------------------------------------------

Pin Signal Pin Signal No. Name No. Name 1 RESULT<0> 43 TIE 2 TIE 44 MOTORIN 3 TIE 45 RESULT<15> 4 TIE 46 TIE 5 TIE 47 TIE 6 TIE 48 TIE 7 TIE 49 GND 8 GND 50 TIE 9 CLOCK 51 TIE 10 TIE 52 RESULT<1> 11 TIE 53 TIE 12 TIE 54 TIE 13 TIE 55 TIE 14 RESULT<3> 56 TIE 15 TIE 57 RESULT<2> 16 GND 58 TIE 17 TIE 59 TDO 18 RESULT<4> 60 GND 19 TIE 61 TIE 20 TIE 62 RESULT<7> 21 RESULT<5> 63 TIE 22 VCC 64 VCC 23 TIE 65 TIE 24 TIE 66 RESULT<8>

Page 24: Report- VHDL Tachometer

25 RESULT<6> 67 TIE 26 TIE 68 TIE 27 GND 69 RESULT<9> 28 TDI 70 TIE 29 TMS 71 RESULT<10> 30 TCK 72 RST 31 TIE 73 VCC 32 RESULT<13> 74 TIE 33 TIE 75 TIE 34 TIE 76 TIE 35 TIE 77 TIE 36 TIE 78 VCC 37 TIE 79 RESULT<11> 38 VCC 80 TIE 39 RESULT<14> 81 TIE 40 TIE 82 RESULT<12> 41 TIE 83 TIE 42 GND 84 TIE

Legend : NC = Not Connected, unbonded pin PGND = Unused I/O configured as additional Ground pin TIE = Unused I/O floating -- must tie to VCC, GND or other signal VCC = Dedicated Power Pin GND = Dedicated Ground Pin TDI = Test Data In, JTAG pin TDO = Test Data Out, JTAG pin TCK = Test Clock, JTAG pin TMS = Test Mode Select, JTAG pin PROHIBITED = User reserved pin

Page 25: Report- VHDL Tachometer

Implementation Diagram

Page 26: Report- VHDL Tachometer

ConclusionsThe counting engine for the Tachometer was successfully implemented in VHDL and simulated using ModelSim III XE (starter edition). The code behaves as required for the purpose of counting and displaying, and has been tested to remove any bugs.

The design was realized on a Xilinx XC95108 in ISE Project Navigator <12.2>.

Through the project we have enlisted the following CAD tools:

• ModelSim III XE: Simulation and VHDL compiler

• Ghostscript: Printing of simulation results to PDF.

• GIMP: Image and graph editing.

• ISE Project navigator: Implementation on CPLD

The project can hence be synthesized for transfer on a CPLD/FPGA solution, or processed for manufacture.

Page 27: Report- VHDL Tachometer

BibliographyBooks:

• VHDL Primer – Third Edition – J. Bhasker

• Digital Design, 3E – M. Morris Mano,

• Circuit Design with VHDL - Volnei A. Pedroni

Websites:

• NJIT UG course: architecture.njit.edu/academics/undergraduate/artanddesign/dd-brochure.pdf

• ModelSim basics: www.tkt.cs.tut.fi/tools/public/tutorials/mentor/modelsim/getting_started/gms.html

• ModelSim Environment Setup: www.ece.msstate.edu/~reese/EE8993/setup.html

• EDNC VHDL 101: www.ednc.com/bbs/data/file/pds/6734cd03_IntroModelSim60GUI.pdf

• VHDL primer: www.seas.upenn.edu/~ese201/vhdl/vhdl_primer.html

• VHDL resources: esd.cs.ucr.edu/labs/tutorial/VHDL_Page.html

• Tachometer: auto.howstuffworks.com/car-driving-safety/safety-regulatory-devices/speedometer.htm

Page 28: Report- VHDL Tachometer

Illustration IndexIllustration 1: Automobile Tachometer......................................................................................................3Illustration 2: Galvanometer......................................................................................................................7Illustration 3: Entity Diagram....................................................................................................................8Illustration 4: Simulation in ModelSim...................................................................................................14

Alphabetical Indexduty cycle ..................................................................................................................................................8Function Block.........................................................................................................................................22galvanometer .............................................................................................................................................7instrument...................................................................................................................................................4ISE Project Navigator..............................................................................................................................14macrocells..................................................................................................................................................5ModelSim XE III.....................................................................................................................................14R-2R...........................................................................................................................................................7redlining.....................................................................................................................................................3RPM Transducer........................................................................................................................................6tachometer..................................................................................................................................................3TIE...........................................................................................................................................................24XC95108..................................................................................................................................................21