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
Memory Address The memory  address is of 16  bits. It ranges from 0000?H to  FFFH 16bits address lines of 8085 microprocessor are  capable  of addressing 216 i e 65, 536, ( or

What are the Advantages of using robots -  They are able to work non-stop; they don't need a break -  They are capable of working in conditions hazardous to humans -  Ess

a. Given a timer with a terminal count and a clock frequency of 10 MHz measure the following: (i) Range & Resolution (ii) Terminal count values needed to measure 3ms interval

Q. Show the procedure of Octal to Decimal Conversion? To convert from Octal to Decimal, multiply the value in every position by its Octal weight and add each value. Using the v

Explain Medium length lines? Medium length lines cover lines in the range of 50 to 150 miles (80 to 240 km). Due to the increased length of the line, the shunt capacitance of t

Experiment • Wire the circuit shown in Figure. Connect the three oscilloscope channels as shown in Figure. • Select the sinusoidal waveform. Adjust the frequency of the input volt

Figure 1(a) shows a simple one-stage MOSFET amplifier. The input-output relationship is graphed in Figure 1(b), where the solid curve indicates operation in the saturated region an

1.Determine and plot the ratios μ tr /μ and μ ab /μ  from 5 keV to 100 MeV for      (a) air,              (b) water,      (c) muscle,     (d) bone, and      (d) lead

Q. Explain, with the aid of diagrams, the following in relation to the construction of power transformers. Include the advantages and disadvantages in your description. a) Core