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

Test schedule - meter testing, Test Schedule - Meter Testing The test ...

Test Schedule - Meter Testing The test schedule as per the Central Electricity Authority Regulations on Installation and Operation of Meters is given below. Table: Test S

Determine the current by mesh analysis, Q. Determine the current I through ...

Q. Determine the current I through the 10- resistor of the circuit of Figure by employing the node-voltage method. Check by mesh analysis.

Thevenin theorem, advantages and disadvantages of thevenin theorem

advantages and disadvantages of thevenin theorem

Design a circuit for indicate the connection of a battery, You are asked to...

You are asked to design a circuit that indicates if a 12 V battery has been connected the correct way around to two terminals, A and B. To do this, you have chosen to use a special

Role of stakeholders in distribution reform, Role of StakeHolders in Distri...

Role of StakeHolders in Distribution Reform These challenges could be met only by comprehensive reforms in the distribution sector. Earlier, you have studied about the roles o

Constant frequency system, Constant Frequency System In this  system c...

Constant Frequency System In this  system chopping period  T is kept constant but the  on time T om is varied. This  system is also referred to pulse with modulation or time

Architecture of 8085 microprocessor, Architecture of 8085 Microprocessor ...

Architecture of 8085 Microprocessor The 8085  microprocessor  is an 8 bit  general purpose microprocessor. 8 bit  processor  means it can  read write  and process 8 bit  data

Telecommunication, Design a low noise amplifier using an Infineon RF transi...

Design a low noise amplifier using an Infineon RF transistor BFP640. The amplifier is to be used to amplify the L2 GPS signal and so the centre frequency is 1227MHz and bandwidth 4

Fast recovery diodes - types of power diodes , Fast  Recovery diodes ...

Fast  Recovery diodes The fast  recovery  diodes low recovery times. These diodes  are manufactured by diffusion. They are used in converter circuits where  the speed  of reco

Develop and execute a pspice program, Develop and execute a PSpice program ...

Develop and execute a PSpice program to solve for the current I 2 in Figure.

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