1 / 22

Lab 5 Signal Analyzer/Generator

Lab 5 Signal Analyzer/Generator. Introduction. Create a client MFC application that samples a signal and displays wave using Windows GDI, Open GL, or DirectX. Digitally analyze and generate analog waveforms Reconstruct the waveform using the sampled signal . Spartan 3 board. Tutorial 1.

sevita
Download Presentation

Lab 5 Signal Analyzer/Generator

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab 5Signal Analyzer/Generator

  2. Introduction • Create a client MFC application that samples a signal and displays wave using Windows GDI, Open GL, or DirectX. • Digitally analyze and generate analog waveforms • Reconstruct the waveform using the sampled signal

  3. Spartan 3 board Tutorial 1 Tutorial 2 Tutorial 3 http://www.digilentinc.com/Products/Detail.cfm?Prod=S3BOARD&Nav1=Products&Nav2=Programmable

  4. Acquiring an Analog Signal • Input is a signal with peak to peak of 5 V • Voltage input in the range -2.5 to 2.5 V • Use Analog to Digital Converter ADC0820 • Input’s analog voltage 0 to 5 V • Requires adding 2.5 Volts to input signal before converted.

  5. Voltage compatibility issue • Spartan 3 uses a 5 V adapter • Internal voltage levels are 3.3 V, 2.5 V and 1.2 V. • ADC0820 needs a 5V, Output levels are close to 5V • Inputs cannot handle 5 V without a current limiting resister. • Use R > 170 Ohms to limit current to 10 mA. • Alternately, since the FPGA I/O are TTL compatible, you may want to use TTL buffers to limit the voltage levels to about 3.4 V.

  6. Sampling Signals on Serial Port • Max Baud Rate 115,200 • 115,200 bits per second • Max Sampling Frequency • 115,200 / 10 bits (8 data, 1 start, 1 stop) • Max Input Frequency to avoid aliasing • (Max Sampling Frequency) / 2 • = 5760 Hz

  7. Discrete Fourier Transform (DFT) • Can be processor intensive thus use Fast Fourier Transform (FFT) to calculate DFT • Algorithm requires a sampling frequency as a power of 2 • Refer to FFT function on UL-99 (C++)

  8. Windows GDI If you took 408 you probably already know this

  9. Device context classes • CPaintDC - for drawing on windows client handlers (on paint only) • CClientDC - for drawing on windows client handlers (anytime other then on paint) • CWindowDC – for drawing anywhere in a window • CMetafileDC - Drawing to a GDI metafile

  10. How to draw • Create paint object • Move to point • Draw line

  11. How to draw • CClientDC DC(this) • DC.MoveTo(0,0); • DC.LineTo(100,100); • When the window calls on_paint the window will clear the area.

  12. How to keep a drawing on a screen • Void draw(CDC* pDC,CRect rect) • { pDC->Rectangle(rect) • }

  13. How to keep a drawing on screen • Onpaint() • { CRect rect; GetClientRect (&rect); CPaintDC dc(this); draw(&dc,rect); • }

  14. Other draw functions • Rectangle • Arc • PolyLine • MoveTo • Pie • Ellipse • RoundRect

  15. Coordinatestaken from programming with MFC second edition

  16. Coordinates • How to set • CClientDC dc(this) • dc.SetMapMode (MM_LOMETRIC);

  17. Why you should use a pixel coordinate systems and pitfalls • There are only so many pixels on a screen, this is set by a screen resolution. • In a pixel coordinate system, how many pixels on a client window can be found by finding the size by using: • GetClientRect(CRect rect); • 1 pixel is the most accurate there is (no such thing as ½ pixel in GDI)

  18. Changing Color • CPen pen; • pen.CreatePen (PS_SOLID, 1, RGB (255, 0, 0)); • CClientDC dc(this) • CPen *oldPen = dc.SelectObject(&pen);

  19. Changing Color Taken from programming with MFC, Second Edition

  20. Different Lines Taken from programming with MFC, Second Edition

  21. Draw Text • CPaint dc(this) • dc.SetTextAlign(TA_RIGHT); • dc.TextOut(0,0,”hello”);

  22. Anything else? • THERE IS MORE YOU CAN DO • This is just on the basics • Anything other details can be found on the MSDN.

More Related