Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Electrical & Electronics Expert

First section

Aim: the aim of this project is to produce a storage scope using a PIC.

In this project, several samples were taken from an analog signal and stored in the memory and the result was displayed constantly on the CRO. The storage scope was used in order to take the required samples from the analog signal. The result can be displayed even without the original signal.

The following processes were used in order to achieve the aim of this project. A microcomputer for the storage scope and an analog to digital (A/D) and digital to analog(D/A) conversion, a switch to start the sampling of the analog signal and finally an output  line was used for triggering the external input to the CRO.  The entire taken samples was displayed in a loop constantly.

A short trigger pulse was sent to the output line to trigger the CRO at the beginning of the display loop.

The CRO was adjusted on the external trigger mode and the stored samples were displayed on its screen immediately after the trigger signal was received at its input.

The position marked as EXT on the CRO was used when the external signal was applied to the horizontal input. The INT/EXT switch selects the internal or external trigger signal.

The signal applied to the external trigger of the CRO connects external signal to trigger circuit for synchronization.

Second section

At the start of the program, an INIT subroutine was called to go to this subroutine and configure the PORTD as an output by making all the pins of this port 0. Then it was saved under a TRISD. Two bits of PORTA (4 and 5) were configured as an output pin and other as input. That was then saved under the TRISA. To left justify the result in the ADRESH and AN4 as digital, the required pin codes was found, configured and saved into ADCON1. The same process was done for the ADCON0. The fifth and fourth pins of the PORTA was cleared and set respectively in order to select the channel A and deactivate WR signal on the D/A.

After the program returned, the required 225 as decimal was saved into the counter named CNTR_S and CNTR_D. The sampling routine was placed within the program to get the conversion of analog to digital signal which will call this subroutine and saves the result in the CNTR_S.

The "continuous _loop" will call the trigger routine for generating the external trigger pulse. Number of "nop" instruction was used in order to settle the output signal with these short delays.

within this subroutine, selected the channel B on the D/A first by selecting the bit 5 on PORTA and then PORTD was set in order to send a 5V to channel B of the D/A.

The PORTD was cleared after the "nop" instructions to send 0 to channel B of the D/A and then the fourth bits of the PORTA which was set to deactivate the WR. In addition the fifth bit of the same port (PORTA) which was set to select the channel B , was cleared in order to return to channel A on the D/A. The program was returned after.

Within the displaying subroutine the digital to analog conversion routine was called and the value of the CNTR_D was decremented. The bnz was used to verify if the bit is not zero to branch back to displaying subroutine. The program then was branched to the continuous _ loop. The program then was tested with 1KHZ signal.

Third section

The samples rate was supposed to be taken at the rate of 10KHZ which was demanded by the project handout.

The program at this stage was modified to setup the Timer0 to interrupt the PIC at around 100 microsecond intervals which is the time taken between each of the samples.

At the beginning of this section the program will jump into the interrupt service routine to clear the Timer0 flag and call the analog to digital conversion and again decrement the CNTR_S. Within the analog to digital conversion, the program will wait for a short time for the taken samples to settle down as well as waiting for the conversion to finishes before moves the contents of ADRESH to the memory and return back from the program. When the 225 samples were obtained, the program then will branch to display the collected samples. To return from the interrupt the retfie was used. Similar to the previous step the INIT subroutine was called with the same process, and after deactivating WR signal on the D/A the program will return back from this subroutine. The counter for 225 sampling was programmed and the counter D which was placed for the displaying also given a decimal 225. The same process call for the trigger subroutine was done in order to generate external trigger pulse.

Afterwards the digital to analog conversion was done and the value of the counter D was decremented by 1. Similar to the previous steps the samples were displayed frequently once all the samples were taken. To make an infinite loop at this stage the program was branched back to the "continous_loop".

Fourth section

At the beginning of this section, the program will branch to start to do the required initialisation and call for the subroutines the Similar to the previous step. Within the INIT subroutine an extra code was placed to activate the priority features by using bsf  RCON,IPEN. The required pins were also configured as well as the required channel.

The entire in use samples which was saved, were sent to the CRO at the same rate to include the timing data in the output display. When the program returns, it will jump into the high priority interrupt which was activated. In this subroutine the Timer0 was cleared and the analog and digital conversion was done by calling this subroutine. The counter S was decremented by 1 and when the entire 225 samples was obtained , the program will go_to_low routine to go to low priority and call the trigger subroutine to generate external trigger pulse. Otherwise the program will jump to the routine called sample_again to return from the high priority interrupt. To handle the sampling the high priority ISR was used the high priority interrupt is situated at the high interrupt vector 0008.

After the sampling was completed the low priority ISR was then selected to hold the display.  the program will jump then into the low priority interrupt which is located in 0018 to clear the Timer0 flag, convert the digital to analog by calling this subroutine, decrement the counter D by 1, and to get another trigger after displaying 225 samples it will be branched to a routine called need_a_ trigger to go to this label and get another require trigger. Then the program will be branch to display_again to return from the low priority interrupt. 

The display routine was then modified in the way that after receiving Timer0 interrupt, one sample was sent to the CRO.

Fifth section

To trigger the start of sampling the start switch was used which will start the sampling for the first time once the switch pressed. In order to achieve this process the program needs to wait until the switch is pressed and then starts sampling at the rate of 10 kHz.

Similar to the process for the previous step, after calling the INIT subroutine and start the sampling and saving the 225 samples in the mentioned counters the program will jump into the high priority interrupt in which the Timer0 flag will be cleared .To check if the switch is pressed, a subroutine called "yes_press" was placed to start the conversion of the analog to digital by calling this subroutine when the switch is pressed. The program then will decrement the counter S and after obtaining the entire 225 samples it will go to the go_to_low routine to go to the low priority and call the trigger subroutine. Otherwise the program will be branched to the sample_again to return from the high priority interrupts.

Within the low priority interrupt after calling this subroutine at the beginning of the program the Timer0 flag again was cleared and for implementing the use of the switch in the recommended polling method, the btfss INTCON, INT0IF was used. If the configured input switch was not pressed the program will jumped into the subroutine called no_press to call for the conversion of digital to analog and decrement the counter D by 1.after 225 samples were obtained, the program needs another trigger. That was done by referring into the need_a_trigger routine to go into the go_to_low rouine to get the required trigger. Then the program will be branched into the display_again routine to continue displaying the samples and returns from the low priority interrupt. If the switch pressed the program will restart sampling by going back to the yes_press routine.

The taken samples then was sent repeatedly to the D/A to the CRO to be displayed at the same rate. While the result is displaying if the start switch pressed again the trigger will start sampling again.

 Discussion: it was tried to write the program for 1000 sampling but the correct result was not obtained, therefore the sampling value was reduced to 225 and 1bit of the counter was used in order to be able to get the correct result.

Conclusion:

The AN4 (RA5) pin was configured as a digital and output in order to switch the channels of D/A and that was forced to change the configuration of the ADCON1 to the 0100.

One of the differences of this project with the practical of the A/D and D/A conversion was that within this project the sampling was saved into the memory by using the POSTINC0, PORTD .this will saves the data into the PORTD which was configured as an output port.

 

Electrical & Electronics, Engineering

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

Have any Question?


Related Questions in Electrical & Electronics

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 ...

Question 1 a pnp transistor withnbspbeta 60 is connected

Question 1. A pnp transistor with β = 60 is connected in a common-base configuration as shown in figure P5.8 (a) The emitter is driven by a constant-current source with I E = 0.75 mA. Determine I B , I C , α, and V C . ( ...

Advanced computational techniques in engineering assignment

Advanced Computational Techniques in Engineering Assignment - Optimisation For this assignment, you are required to carry out the process of attempting to solve different optimisation problems. For each question, you are ...

Questions -problem 1 - solve for i0 in fig using mesh

Questions - Problem 1 - Solve for i 0 in Fig. using mesh analysis. Problem 2 - Use mesh analysis to find current i 0 in the circuit. Problem 3 - Use mesh analysis to find v 0 in the circuit. Let v s1 = 120 cos(100t+ 90 o ...

Problems -problem 1 - find v0 in the op amp circuit of fig

Problems - Problem 1 - Find v 0 in the op amp circuit of Fig. 1. Problem 2 - Compute i 0 (t) in the op amp circuit in Fig. 2 if v s = 4 cos(10 4 t). Problem 3 - If the input impedance is defined as Z in = v s /I s , find ...

Case studythis assignment consists of a written report of

CASE STUDY This assignment consists of a written report of approximately 1000 words and any diagrams in which you are asked to critically compare different process methods used to achieve the same result and show an awar ...

Assignment -problem 1 -a consider the simplified dc system

Assignment - Problem 1 - a) Consider the simplified dc system shown in Fig. 1. Only one converter is modeled, with the remote end represented by a dc source. The ac system is rated at 345 kV, with the converter transform ...

Nanotechnology engineering program assignment - passive

Nanotechnology Engineering Program Assignment - Passive Filters Q1) Determine what type of filter is in circuit shown. Calculate the cutoff frequency f c . Q2) Determine what type of filter is in circuit shown. Calculate ...

Research report1 read 3 to 4 journal articles about

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 ...

Question -i a star-connected three-phase synchronous

Question - (i) A star-connected, three-phase synchronous induction motor takes a current of 10 amps from a 415 volt supply at unity power factor when supplying a steady load. If the synchronous reactance is 5 ohms/phase ...

  • 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