Produce a storage scope using peripheral interface control, Electrical Engineering

Assignment Help:

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.

 


Related Discussions:- Produce a storage scope using peripheral interface control

Cause of sparking at the brushes of a dc motor, Q. Cause of sparking at the...

Q. Cause of sparking at the brushes of a DC Motor? Ans: Sparking at the brushes can be occur due to poor quality of carbon brushes, loose connection, poor armature of carbon

Calculate the maximum analog output voltage, Q. For the 4-bit D/A converter...

Q. For the 4-bit D/A converter of Figure, calculate: (a) The maximum analog output voltage. (b) The minimum analog output voltage. (c) The smallest detectable analog outpu

Find the current through the diode in the circuit, Q. A diode is connected ...

Q. A diode is connected in series with a voltage source of 5 V and a resistance of 1 k. The diode's saturation current is given to be 10 -12 A and the I-V curve is shown in Find

Determine the maximum electric field in the depletion region, An abrupt sil...

An abrupt silicon (n i = 10 10 cm -3 ) p-n junction consists of a p-type region containing 10 16 cm -3 acceptors and an n-type region containing 5 x 10 16 cm -3 donors. a)

Push psw instruction , PUSH PSW Instruction It is similar to above  pu...

PUSH PSW Instruction It is similar to above  push  instruction but instead of normal  register Paris it use PSW as its  operand. Program status  word comprises of  the content

Help needed in degree project, i have to design a project title "Edge deter...

i have to design a project title "Edge determining techniques for Low quality images in different lighting conditions and we use matlab for images simulation by changing different

Define time and shift invariant, Define Time and Shift Invariant? Time ...

Define Time and Shift Invariant? Time and shift invariant means that the system characteristics and shift do not change with time, i.e. the system output is independent of the

Illustrate bandstop filter, Q. The dual situations is shown in Figure , in ...

Q. The dual situations is shown in Figure , in which a high-pass and a low-pass filter are connected in parallel to produce a bandstop filter. With ω CLP = 10 CHP = 50, ω 0

Explain assume assembler directive, Explain the ASSUME assembler dire...

Explain the ASSUME assembler directive with example ASSUME: It will be used to map the segment register names along with memory addresses. The Syntax is as g

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd