Produce a storage scope using peripheral interface control, Electrical Engineering

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.


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.


Posted Date: 3/5/2013 7:47:39 AM | Location : United States

Related Discussions:- Produce a storage scope using peripheral interface control, Assignment Help, Ask Question on Produce a storage scope using peripheral interface control, Get Answer, Expert's Help, Produce a storage scope using peripheral interface control Discussions

Write discussion on Produce a storage scope using peripheral interface control
Your posts are moderated
Related Questions
Q. Effect of feedback on dynamic response and bandwidth? Let us consider the block-diagram representation of the open-loop system shown in Figure 16.2.5(a), whose direct transf

Q. A 10-kW, 230-V shunt generator, with an armature-circuit resistance of 0.1  and a field- circuit resistance of 230 , delivers full load at rated voltage and 1000 r/min. If the

Q. Explain the theory of thermal runaway?           The maximum average power Pdmax which a transistor can dissipate depends upon the transistor construction and may lie in the

Modern complex systems are normally constructed by interconnecting sub-units. Therefore the systems engineer is often not too concerned about the details of what is inside these

Switching Characteristics Switching  characteristics  of BJT  are shown  in figure. Due  to the presence of internal  capacitances BJT  cannot be  turned  instantly. Initially

Q. If b and a are the radii of the outer and inner conductors, respectively, of a coaxial cable using a polyethylene dielectric (ε r = 2.26), what ratio b/a is needed for the cabl

Q. Grade of Service In loss systems? Grade of Service : In loss systems, traffic carried by the network is normally lower than actual traffic offered to the network by subscri

Ferroelectric materials are characterised by (A) Very high degree of polarisation. (B) A sharp dependence of polarisation on temperature. (C) Non-linear dependence o

block diagram of eigen face,Viola & Jones Method,Bio-ID,RWTH-i6 Groups of People Database