Tutorial 15 - ADC's and DAC's on the Spartan 3E Starter Board

Similar documents
12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

Digital Design with VHDL

Part 1. MAX BIT DAC with an Arduino Board. MIDI to Voltage Converter Part1

DAC Digital To Analog Converter

VHDL Test Bench Tutorial

Sprites in Block ROM

Interfacing Analog to Digital Data Converters

VGA video signal generation

DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev Key Design Features. Block Diagram. Generic Parameters.

Conversion Between Analog and Digital Signals

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

VHDL GUIDELINES FOR SYNTHESIS

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

Digital Systems Design. VGA Video Display Generation

Arduino DUE + DAC MCP4922 (SPI)

An Example VHDL Application for the TM-4

FR FAMILY MB91460 SPI - DAISY CHAIN COMMUNICATION 32-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

Microcomputers. Analog-to-Digital and Digital-to-Analog Conversion

Rotary Encoder Interface for Spartan-3E Starter Kit

Lesson 16 Analog-to-Digital Converter (ADC)

VHDL programmering H2

Lab Experiment 1: The LPC 2148 Education Board

FPGA INTEGRATION MANUAL SATURN-SIL 2 MODULES. Dictionary Code. Edition 01. Revision 00. Number of pages 18

! " # # $ '"() * #! +, # / $0123$

Using Altera MAX Series as Microcontroller I/O Expanders

ADS9850 Signal Generator Module

Lab 1: Introduction to Xilinx ISE Tutorial

CHAPTER 11: Flip Flops

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

Application Note 120 Communicating Through the 1-Wire Master

Quartus II Introduction for VHDL Users

CPE 462 VHDL: Simulation and Synthesis

Embedded Systems Design Course Applying the mbed microcontroller

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

Design of Remote Laboratory dedicated to E2LP board for e-learning courses.

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

8051 MICROCONTROLLER COURSE

How To Use An Ams 5812 Pressure Sensor With A Usb Starter Kit

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Hardware Implementation of the Stone Metamorphic Cipher

PROGRAMMABLE ANALOG INTEGRATED CIRCUIT FOR USE IN REMOTELY OPERATED LABORATORIES

Digital to Analog and Analog to Digital Conversion

Accurate Measurement of the Mains Electricity Frequency

Simplifying System Design Using the CS4350 PLL DAC

Using the HT46R46 I/O Ports to Implement Half-Duplex SPI Communication

Implementing SPI Communication Between MSP430 G2452 and LTC ADC

Serial port interface for microcontroller embedded into integrated power meter

Decimal Number (base 10) Binary Number (base 2)

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

AES (Rijndael) IP-Cores

EC313 - VHDL State Machine Example

Reading User Data from Configuration PROMs

Analog/Digital Conversion. Analog Signals. Digital Signals. Analog vs. Digital. Interfacing a microprocessor-based system to the real world.

Manchester Encoder-Decoder for Xilinx CPLDs

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

Modeling Registers and Counters

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales FEATURES S8550 VFB. Analog Supply Regulator. Input MUX. 24-bit Σ ADC. PGA Gain = 32, 64, 128

2.0 Command and Data Handling Subsystem

PCM Encoding and Decoding:

The Answer to the 14 Most Frequently Asked Modbus Questions

Design and Verification of Nine port Network Router

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

isppac-powr1220at8 I 2 C Hardware Verification Utility User s Guide

DRM compatible RF Tuner Unit DRT1

Modeling Latches and Flip-flops

Flexible Active Shutter Control Interface using the MC1323x

PLL frequency synthesizer

DS1621 Digital Thermometer and Thermostat

The string of digits in the binary number system represents the quantity

Lab 7: VHDL 16-Bit Shifter

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

Digital Guitar Effects Pedal

The implementation of FPGA for data transmission between ADC and DSP peripherals in the measurement channels for power quality assessment

AC : PRACTICAL DESIGN PROJECTS UTILIZING COMPLEX PROGRAMMABLE LOGIC DEVICES (CPLD)

Debouncing Switches. Mechanical switches are one of the most common interfaces to a uc.

Using Xilinx ISE for VHDL Based Design

A New Paradigm for Synchronous State Machine Design in Verilog

No serious hazards are involved in this laboratory experiment, but be careful to connect the components with the proper polarity to avoid damage.

Fundamentals of Digital Electronics

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

PLL Dynamic Reconfiguration Author: Karl Kurbjun and Carl Ribbing

Using Xbee in Serial Communication

Fractional Burst Clock Data Recovery for XG-PON Applications Author: Paolo Novellini and Massimo Chirico

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

A CPLD VHDL Introduction

LatticeECP3 High-Speed I/O Interface

From VHDL to FPGA

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

The modular concept of the MPA-3 system is designed to enable easy accommodation to a huge variety of experimental requirements.

ARM Cortex -A8 SBC with MIPI CSI Camera and Spartan -6 FPGA SBC1654

Transcription:

Tutorial 15 - ADC's and DAC's on the Spartan 3E Starter Board Introduction Analog to Digital converters, and their counterparts, Digital to Analog converters are used all the time in electronics. Indeed, they provide the only method by which one may interface a digital system with the real world, which functions in analog. In this lab, for the Spartan 3E starter kit, we will be using two twelve bit chips, the PMOD-AD1 and the PMOD-DA2, which house the ADCS7476MSPS and the DAC121S101 chips respectively. We will take in an analog input signal, perform a simple transform (multiply and add by a constant), and output it again as a new signal. The two chips listed serialize their data (so they can fit in small form factors) and can be clocked to a maximum of 20MHz. Both chips require that data be available by the rising edge of the clock, and specify that they will present data on the falling edge of the same clock cycle. Objective To implement a ADC-DAC function in the FPGA. Process 1. Create a clock divider, and clock the rest of the circuit off of it's rising edge. 2. Design a state machine to loop through the process of reading from the ADC and writing to the DAC. 3. Implement ADC and DAC functionality by populating the states of the FSM. 4. Test the system with various functions and an oscilloscope.

Implementation Finite State Machine 1. Use the following four states in succession: idle, read_adc, function, write_dac. This FSM scheme is suggested because it is simple and effective. The idle state serves to set up pins and timing signals before the system is running in earnest, the read_adc state reads the 12 bit signal from the ADC, the function state performs a simple transform on the number and the DAC is then updated to output the result of this transform. ADC 1. The ADC follows a simple format, where, after pulling CS low, four zeroes are transmitted, following by a twelve bit number. This twelve bit number describes the voltage acquired by the circuit. The data is clocked with the MSB first. (from datasheet) Function 1. In this example we simply multiply the twelve bit number by an arbitrary constant, however in principle one can do anything to it.

DAC 1. The DAC follows a similarly simple data scheme, whereby after pulling sync high (it can be left high for the duration of the procedure) 16 bits are written to the circuit. The first two need to be the zeroes, the next two are configuration bits, make certain they are zero as well. The last twelve bits describe the voltage that the DAC will output. In this case it will be the number obtained from the function step. (from datasheet) Verification If one simply changes the multiplier to a large number, one will be able to note the large difference in gain simply by looking at the output voltage through an oscilloscope. In this case, as the input is a simple potentiometer, fewer turns of the screw will effect a greater change in output voltage. Similarly, if the multiplier is less than one, it will take more turns of the screw to make a change in the output voltage. For example, with a gain of 2x, picture 1, will turn into picture 2.

Picture 1: Input signal. Picture 2: Results of the input signal being amplified by 2x.

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity motor is --constrained in ucf file Port ( Clk : in std_logic; --spartan 3 e CS din dout SClk SClk2 end motor; : out std_logic; SYNC : out std_logic; : in std_logic; --adc : out std_logic; --dac : out std_logic; --adc : out std_logic); --dac architecture Behavioral of motor is type state_type is (idle, read, func, write); signal state : state_type := read; signal data : unsigned(11 downto 0); signal cnt : integer range 0 to 20 := 0; signal clkdiv : integer range 0 to 6; signal newclk : std_logic := '0'; signal risingedge : std_logic := '1'; signal reset : std_logic := '0'; begin --drive the adc and dac clock pins SClk <= newclk; SClk2 <= newclk; clock_divider: process(clk, reset) begin if(reset = '1') then elsif(rising_edge(clk)) then if(clkdiv = 5) then risingedge <= risingedge xor '1'; newclk <= newclk xor '1'; clkdiv <= 0; else clkdiv <= clkdiv + 1; end process clock_divider; main: process(clk, reset) variable temp : integer; begin if(reset = '1') then elsif(rising_edge(clk)) then if(clkdiv = 5 and risingedge = '1') then case state is when idle => CS <= '1'; SYNC <= '1'; if(cnt = 15) then

end case; end process main; end Behavioral; state <= read; else state <= idle; when read => CS <= '0'; SYNC <= '1'; if(cnt < 4) then state <= read; elsif(cnt > 3 and cnt < 16) then data(15 - cnt) <= din; state <= read; elsif(cnt = 16) then state <= func; when func => CS <= '1'; SYNC <= '1'; temp := conv_integer(data); temp := temp*2; --y=m*x+b data <= conv_unsigned(temp,12); when write => CS <= '1'; SYNC <= '0'; if(cnt = 0 or cnt = 1) then dout <= '0'; elsif(cnt = 2 or cnt = 3) then dout <= '0'; elsif(cnt > 3 and cnt < 16) then dout <= data(15 - cnt); elsif(cnt = 16) then state <= idle;