Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Electrical & Electronics Expert

Aim

  • To build a simple storage oscilloscope using the PIC trainer
  • To report on the program's design and operation

Equipment

  • PIC Trainer and PICkit3 in-circuit debugger
  • MPLAB Integrated Development Environment software
  • Laboratory CRO and signal generator

Task

Write a PIC program to enable the PIC trainer board to be used as a simple storage oscilloscope.

Basic Operation

The program should work as follows:

  • When the "capture" pushbutton (PB1) is pressed, the program begins capturing and storing 1000 samples of the signal connected to the analog input terminal (the BNC connector for AN2) at the rate of 10 kHz (1 sample every 100 µs).
  • When the capture process is complete, the program repetitively replays the stored samples (at the same 10 kHz rate) via the analog output terminal (DAC channel A). The beginning of each replay cycle is marked by a brief synchronising pulse (DAC channel B).

You can verify that your program is working correctly using a signal generator to supply input and an oscilloscope to view the output.  Connect the signal generator to both the PIC trainer input and to Channel I on the CRO (you'll need a BNC T-connector) so you can monitor the input.  Connect the PIC trainer signal output to Channel II on the CRO, and the sync output to the external trigger input on the CRO.  Before connecting the signal generator to the PIC trainer, make sure that its output amplitude and offset is adjusted so that the signal voltage is always within the range 0 V to 5 V. 

Exceeding these limits could damage the PIC processor chip.

Extensions

It is possible to score close to full marks for this project if you implement only the basic operations described above.  However, if your program is working correctly and you are looking for maximum marks, you can attempt one or both of these extensions.

Variable sample rate: The sample rate for both capture and replay is determined by port B DIP switches 1 and 2:

Auto trigger mode:  Port B DIP switch 3 (RB4) controls "auto-trigger" mode.  If the switch is on when the "capture" button is pressed, the capture does not begin until the input signal crosses the 2.5 V threshold from below.  If the switch is off, capture begins immediately.

Hints

Although you can determine the state of PB1 by testing bit 1 of PORTB, it's much easier to write the code if you instead test the INT1 interrupt flag bit (in register INTCON3).  The latter approach is simpler because the flag is set when the button is pressed and remains set until you explicitly clear it.  To make the flag sensitive to the falling edge (the pushbuttons are active low), you'll need to set the appropriate edge polarity (in INTCON2).

The simplest way to store and retrieve the signal samples is using indirect addressing.  At the beginning of a capture or replay cycle, load one of the file select registers (FSR) with the address of the beginning of the data block where the samples are stored, then use the appropriate POSTINC register so that the address is automatically incremented after each reference.

The structure of your program will be simplest if you use interrupts to manage the capture and replay timing.  Configure a timer to generate interrupts at the sample rate, then write an interrupt handler that will process a single sample.  You'll need to devise a way for the handler to know whether the program is in capture or replay mode.

You'll probably find it most convenient to use timer 2 to generate the timing, because you can use its period register to fine-tune the timeout length to exactly 100 µs.

Assessment

Functionality

1. Sampling: The program samples its input and produces analog output.  However, the output is not an accurate copy of the input, or the program does not capture and replay correctly.

2. Storage: The program successfully captures and continuously replays an accurate copy of its input.  However, the rate or length of the sampling is not correct.

3. Timing: The capture and replay is correct in every detail, including sample rate and length.

4. Sample rate: The sample rate is correctly controlled by the Port B DIP switches.

5. Triggering: The auto-trigger facility is correctly implemented.

Code

1. Structure: The code is organised logically, with each subroutine having a well-defined role.  Registers are used appropriately to store data and pass it between modules.

2. Assembler directives: Appropriate use is made of assembler directions, including constant definitions, data directives, assembly-time expressions, and macros.

3. Documentation: The program has an introductory comment listing its function, creation date, and authors.  Each subroutine has a comment describing its purpose and explaining where it expects to find any input it needs, and where it will put any output it produces.  Instructions whose purpose is unclear include a brief end-of-line comment to clarify their function.

4. Presentation: The code is attractively presented and easy to follow. Indentation is consistent and follows established norms.  Labels and names are good descriptors for the entities they denote.

5. Use of interrupts: The interrupt system is used appropriately to manage the real-time aspects of the program.  Timers are used where appropriate to determine time-dependent behaviour.

Report 1. Completeness:  The report is complete and contains all necessary information.  The length of the report is within expected guidelines.

2. Presentation: The report is attractively presented, with few spelling and grammatical errors, appropriate use of fonts, and consistent page layout. 

3. Writing style:  The report is written in a clear and direct style, and flows smoothly.  The level of discourse is appropriate for the audience.

4. Technical details: The report uses appropriate terminology and forms of expression.  Discussions of a technical nature are factually correct.

5. Use of figures: The report makes effective use of figures and other illustrative content.  Figures are well integrated into the text, and contribute significantly to the understanding of the material.

 

Electrical & Electronics, Engineering

  • Category:- Electrical & Electronics
  • Reference No.:- M9524370

Have any Question?


Related Questions in Electrical & Electronics

Questions -problem 1 - determine the laplace transform ofa

Questions - Problem 1 - Determine the Laplace transform of: (a) cos(ωt + θ) (b) sin(ωt + θ) Problem 2 - Obtain the Laplace transform of each of the following functions: (a) e -2t cos(3t)u(t) (b) e -2t sin(4t)u(t) (c) e - ...

Problem 1given a sequence xn for 0lenle3 where x0 1 x1 1

Problem # 1: Given a sequence x(n) for 0≤n≤3, where x(0) = 1, x(1) = 1, x(2) = -1, and x(3) = 0, compute its DFT X(k). (Use DFT formula, don't use MATLAB function) Problem # 2: Use inverse DFT and apply it on the Fourier ...

1 a name the three major groups of contamination and

1. (a) Name the three major groups of contamination and briefly describe their physical characteristics. (b) Where do the above contamination types come from? Give one example of each. 2. Name two processes metrics which ...

Questions -q1 a single-phase transformer rated 21 kv130 v

Questions - Q1. A single-phase transformer rated 2.1 kV/130 V, 7.8 kVA has the following winding parameters: r1= 0.7Ω, x1 = 0.9Ω, r2 = 0.04Ω and x2 = 0.05Ω. Determine: a. The combined winding resistance ________ Ω and le ...

Assignment -consider a common emitter amplifiernow lets say

Assignment - Consider a common emitter amplifier: Now let's say that R B and R C do a fine job at DC biasing the BJT but they are large so they can be neglected for small signal (AC) analysis. In that case, the equivalen ...

1 a name the three major groups of contamination and

1. (a) Name the three major groups of contamination and briefly describe their physical characteristics. (b) Where do the above contamination types come from? Give one example of each. 2. Name two processes metrics which ...

Discuss the role of load factor on the cost of electrical

Discuss the role of load factor on the cost of electrical energy.

Research report1 read 3 to 4 journal articles about digital

Research report 1. Read 3 to 4 journal articles about digital control or industrial control, eg. one particular application, implementation aspect such as selection of sampling time, hardware etc. No text book example is ...

Questions -problem 1 - a series rlc network has r 2 komega

Questions - Problem 1 - A series RLC network has R = 2 kΩ, L = 40 mH and C = 1μF. Calculate the impedance at resonance and at one-fourth, one-half, twice, and four times the resonant frequency. Problem 2 - Design a serie ...

Summative assessmentin 2017 sej101 assessment will consist

Summative Assessment In 2017 SEJ101 assessment will consist of nine tasks that will develop a portfolio of your assessed work. Throughout the trimester you will have the opportunity for feedback on all nine tasks before ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As