SlideShare a Scribd company logo
1 of 34
PC-BASED DIGITAL OSCILLOSCOPE
1 | P a g e Department Of Electronics and Communication Engineering
MAIN PROJECT
REPORT ON
PC-BASED
DIGITAL OSCILLOSCOPE
USING
PIC MICROCONTROLER
PC-BASED DIGITAL OSCILLOSCOPE
2 | P a g e Department Of Electronics and Communication Engineering
ABSTRACT
The digital oscilloscope attempts to achieve the same functionality as a traditional
oscilloscope, using a PIC microcontroller for data acquisition (including appropriate
analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based
software application will then display the waveform as it would appear on a traditional CRT
oscilloscope. This software application will have additional features not present on a
traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional
features can be added as their developed without the need for new hardware. Additional
function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to
measure the circuit parameters like capacitance, resistance, current and voltage of the
required component.
PC-BASED DIGITAL OSCILLOSCOPE
3 | P a g e Department Of Electronics and Communication Engineering
TABLE OF CONTENTS
1. INTRODUCTION......................................................................................... 4
2. FUNDEMENTALS........................................................................................ 5
2.1 THE BASIC CRT OSCILLOSCOPE............................................................................................... 5
2.2 DIGITAL SAMPLING OSCILLOSCOPES ...................................................................................... 7
2.3 THE PIC MICROCONTROLLER.................................................................................................. 8
2.4 UNIVERSAL SERIAL BUS INTERFACE ....................................................................................10
3. THE PIC18F2550 MICROCONTROLLER ...................................................... 11
3.1 OVERVIEW OF THE 8-CHANNEL 10-BIT ADC...........................................................................12
3.2 OVERVIEW OF THE HID USB PERIPHERAL...............................................................................13
4. HARDWARE DEVELOPMENT ................................................................... 14
5.1 SIMPLIFIED BLOCK DIAGRAM .................................................................................................14
5.2 DESCRIPTION ..........................................................................................................................15
5.3 DIGITAL CIRCUIT DIAGRAM ....................................................................................................18
5.4 FLOWCHART............................................................................................................................19
5. THE SCOPE PROGRAM............................................................................. 20
6.1 PIC PROGRAMME...................................................................................................................20
6.2 VISUAL BASIC PROGRAM CODE .............................................................................................23
6. FUTURE WORK ....................................................................................... 31
7. SUMMARY AND CONCLUSION................................................................ 32
8. REFERENCES ........................................................................................... 34
PC-BASED DIGITAL OSCILLOSCOPE
4 | P a g e Department Of Electronics and Communication Engineering
INTRODUCTION
An oscilloscope is a type of electronic test instrument that allows signal voltages to
be viewed, usually as a two-dimensional graph of one or more electrical potential
differences (vertical(Y) axis) plotted as a function of time or of some other voltage
(horizontal(x) axis). Although an oscilloscope displays voltage on its vertical axis, any other
quantity that can be converted to a voltage can be displayed as well. In most instances,
oscilloscopes show events that repeat with either no change, or change slowly. The
oscilloscope is one of the most versatile and widely-used electronic instruments.
Oscilloscopes are commonly used when it is desired to observe the exact wave shape
of an electrical signal. In addition to the amplitude of the signal, an oscilloscope can show
distortion and measure frequency, time between two events (such as pulse width or pulse
rise time), and relative timing of two related signals. Some modern digital oscilloscopes can
analyze and display the spectrum of a repetitive event
The digital oscilloscope attempts to achieve the same functionality as a traditional
oscilloscope, using a PIC microcontroller for data acquisition (including appropriate
analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based
software application will then display the waveform as it would appear on a traditional CRT
oscilloscope. This software application will have additional features not present on a
traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional
features can be added as their developed without the need for new hardware. Additional
function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to
measure the circuit parameters like capacitance, resistance, current and voltage of the
required component.
Digital oscilloscopes have two main advantages over traditional analogue scopes: -
1. The ability to observe slow and very slow signals as a solid presentation on the
screen. Slow moving signals in the 10-100 Hz range are difficult to see and measure
on a normal analogue oscilloscope due to the flicker of the trace and the short
persistence of the spot on the screen.
2. The ability to hold or retain a signal in memory for long periods.
The PIC microcontroller has a built-in ADC (8, 10 or 12 bits) which has a voltage range of
0 to 5V. This voltage range is not ideal as most oscilloscopes have a much wider voltage
range including negative voltages (e.g. -100 to 100V); hence an analogue circuit is required
to reduce the voltage positivee signals so they fall between 2.5 and 5V and voltage negative
signals between 0 and 2.5V (i.e. bipolar). The built-in ADC on the PIC is slow and will limit
the maximum sampling frequency; hence an external Flash ADC with direct memory access
will be required to produce a high-performance digital storage oscilloscope (e.g. AD9070 –
10Bit, 100MSPS ADC)
PC-BASED DIGITAL OSCILLOSCOPE
5 | P a g e Department Of Electronics and Communication Engineering
1. FUNDEMENTALS
THE BASIC CRT OSCILLOSCOPE
An oscilloscope draws its trace with a spot of light (produced by a deflectable beam of
electrons) moving across the screen of its CRT. Basically an oscilloscope consists of the CRT,
a ‘time base’ circuit to move the spot steadily from left to right across the screen at the
appropriate time and speed, and some means (usually a ‘Y’ deflection amplifier) of enabling
the signal to deflect the spot in the vertical or Y direction.
This type of oscilloscope is known as a ‘real-time’ oscilloscope. This means that the vertical
deflection of the spot on the screen at any instant is determined by the Y input voltage at
that instant.
The basic oscilloscope is typically divided into four sections: the display, vertical
controls, horizontal controls and trigger controls. The display is usually a CRT or LCD panel
which is laid out with both horizontal and vertical reference lines referred to as the
graticule. In addition to the screen, most display sections are equipped with three basic
controls, a focus knob, an intensity knob and a beam finder button. The vertical section
controls the amplitude of the displayed signal. This section carries a Volts-per-Division
(Volts/Div) selector knob, an AC/DC/Ground selector switch and the vertical (primary) input
for the instrument. Additionally, this section is typically equipped with the vertical beam
position knob.
PC-BASED DIGITAL OSCILLOSCOPE
6 | P a g e Department Of Electronics and Communication Engineering
The horizontal section controls the time base or “sweep” of the instrument. The
primary control is the Seconds-per-Division (Sec/Div) selector switch.
Also included is a horizontal input for plotting dual X-Y axis signals. The horizontal
beam position knob is generally located in this section. The trigger section controls the start
event of the sweep. The trigger can be set to automatically restart after each sweep or it
can be configured to respond to an internal or external event. The principal controls of this
section will be the source and coupling selector switches. An external trigger input (EXT
Input) and level adjustment will also be included.
In addition to the basic instrument, most oscilloscopes are supplied with a probe as
shown. The probe will connect to any input on the instrument and typically has a resistor of
ten times the 'scope's input impedance. This results in a .1 (-10X) attenuation factor, but
helps to isolate the capacitive load presented by the probe cable from the signal being
measured. Some probes have a switch allowing the operator to bypass the resistor when
appropriate.
PC-BASED DIGITAL OSCILLOSCOPE
7 | P a g e Department Of Electronics and Communication Engineering
DIGITAL SAMPLING OSCILLOSCOPES
Digital sampling oscilloscopes use an ADC (analogue-to-digital converter) to
converter analogue voltages to binary representation. The sampling rate specifies the
number of samples taken per second. Figure demonstrates clearly how an analogue wave-
form is digitally sampled and displayed onto the screen (LCD, Computer Monitor, etc…).
The PIC microcontroller has a built-in ADC (8, 10 or 12 bits) which has a voltage range
of 0 to 5V. This voltage range is not ideal as most oscilloscopes have a much wider voltage
range including negative voltages (e.g. -100 to 100V); hence an analogue circuit is required
to reduce the voltage positive signals so they fall between 2.5 and 5V and voltage negative
signals between 0 and 2.5V (i.e. bipolar).
ANALOG
CIRCUITRY
PC-BASED DIGITAL OSCILLOSCOPE
8 | P a g e Department Of Electronics and Communication Engineering
THE PIC MICROCONTROLLER
A PIC (Peripheral Interface Controller) microcontroller is an IC manufactured by
Microchip.
These ICs are complete computers in a single package. The only external
components necessary are whatever is required by the I/O devices that are connected to
the PIC. PICs use the Harvard architecture. The Harvard architecture is an adaptation of the
standard von Neumann structure with separate program and data memory: data memory is
made up by a small number of 8-bit registers and program memory is 12 to 16-bits wide
EPROM, FLASH or ROM.
Traditional CISC (Complex Instruction Set Computer) machines (Used in: 80X86,
8051, 6800, 68000, etc…) have many instructions (usually > 100), many addressing modes
and it usually takes more than 1 internal clock cycle to execute. PIC microcontrollers are
RISC (Reduced Instruction Set Computer) machines, which have 33 (12-bit) to 58 (15-bit)
instructions, reduced addressing modes (PICs have only direct and indirect), each instruction
does less, but usually executes in one internal clock.
A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80
instructions for the high-end PICs. The instruction set includes instructions to perform a
variety of operations on registers directly, the accumulator and a literal constant or the
accumulator and a register, as well as for conditional execution, and program branching.
Some operations, such as bit setting and testing, can be performed on any numbered
register, but bi-operand arithmetic operations always involve W (the accumulator) ; writing
the result back to either W or the other operand register. To load a constant, it is necessary
to load it into W before it can be moved into another register. On the older cores, all
register moves needed to pass through W, but this changed on the "high end" cores.
PIC cores have skip instructions which are used for conditional execution and
branching. The skip instructions are: 'skip if bit set', and, 'skip if bit not set'. Because cores
before PIC18 had only unconditional branch instructions, conditional jumps are
implemented by a conditional skip (with the opposite condition) followed by an
unconditional branch. Skips are also of utility for conditional execution of any immediate
single following instruction.
PC-BASED DIGITAL OSCILLOSCOPE
9 | P a g e Department Of Electronics and Communication Engineering
The PIC architecture has no (or very meager) hardware support for automatically
saving processor state when servicing interrupts. The 18 series improved this situation by
implementing shadow registers which save several important registers during an interrupt.
In general, PIC instructions fall into 5 classes:
 Operation on W with 8-bit immediate ("literal") operand. E.g. movlw (move literal
to W), andlw (AND literal with W). One instruction peculiar to the PIC is retlw, load
immediate into W and return, which is used with computed branches to produce
lookup tables.
 Operation with W and indexed register. The result can be written to either the W
register (e.g. addwf reg,w). or the selected register (e.g. addwf reg,f).
 Bit operations. These take a register number and a bit number, and perform one of
4 actions: set or clear a bit, and test and skip on set/clear. The latter are used to
perform conditional branches. The usual ALU status flags are available in a
numbered register so operations such as "branch on carry clear" are possible.
 Control transfers. Other than the skip instructions previously mentioned, there are
only two: goto and call.
 A few miscellaneous zero-operand instructions, such as return from subroutine,
and sleep to enter low-power mode.
PC-BASED DIGITAL OSCILLOSCOPE
10 | P a g e Department Of Electronics and Communication Engineering
UNIVERSAL SERIAL BUS INTERFACE
USB is a specification to establish communication between devices and a host
controller (usually personal computers). A USB (Universal Serial Bus) system has an
asymmetric design, consisting of a host, a multitude of downstream USB ports, and multiple
peripheral devices connected in a tiered-star topology. Additional USB hubs may be
included in the tiers, allowing branching into a tree structure with up to five tier levels. A
USB host may have multiple host controllers and each host controller may provide one or
more USB ports. Up to 127 devices, including hub devices if present may be connected to a
single host controller.
USB devices are linked in series through hubs. There always exists one hub known as
the root hub, which is built into the host controller. So-called sharing hubs, which allow
multiple computers to access the same peripheral device(s), also exist and work by
switching access between PCs, either automatically or manually. Sharing hubs are popular in
small-office environments. In network terms, they converge rather than diverge branches.
A physical USB device may consist of several logical sub-devices that are referred to
as device functions. A single device may provide several functions, for example, a webcam
(video device function) with a built-in microphone (audio device function). Such a device is
called a compound device in which each logical device is assigned a distinctive address by
the host and all logical devices are connected to a built-in hub to which the physical USB
wire is connected. A host assigns one and only one device address to a function.
USB endpoints actually reside on the connected device: the channels to the host are
referred to as pipes. USB device communication is based on pipes (logical channels). A pipe
is a connection from the host controller to a logical entity, found on a device, and named an
endpoint. The term endpoint is occasionally incorrectly used for referring to the pipe.
However, while an endpoint exists on the device permanently, a pipe is only formed when
the host makes a connection to the endpoint. Therefore, when referring to the connection
between a host and an endpoint, the term pipe should be used. A USB device can have up to
32 active pipes: 16 into the host controller and 16 out of the host controller.
PC-BASED DIGITAL OSCILLOSCOPE
11 | P a g e Department Of Electronics and Communication Engineering
THE PIC18F2550 MICROCONTROLLER
10-BIT ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE
The Analog-to-Digital (A/D) converter module has 10 inputs for the 28-pin devices and 13 for
the40/44-pin devices. This module allows conversion of an analog input signal to a corresponding
10-bit digital number.
The module has five registers:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• A/D Control Register 2 (ADCON2)
ADCON0: A/D CONTROL REGISTER 0
The ADCON0 register, shown below, controls the operation of the A/D module.
bit 7-6 Unimplemented: Read as ‘0’
bit 5-2 CHS3:CHS0: Analog Channel Select bits
0000 = Channel 0 (AN0)
0001 = Channel 1 (AN1)
0010 = Channel 2 (AN2)
0011 = Channel 3 (AN3)
0100 = Channel 4 (AN4)
0101 = Channel 5 (AN5)(1,2)
0110 = Channel 6 (AN6)(1,2)
0111 = Channel 7 (AN7)(1,2)
1000 = Channel 8 (AN8)
bit 1 GO/DONE: A/D Conversion Status bit
When ADON = 1:
1 = A/D conversion in progress
0 = A/D Idle
bit 0 ADON: A/D On bit
1 = A/D converter module is enabled
0 = A/D converter module is disabled
PC-BASED DIGITAL OSCILLOSCOPE
12 | P a g e Department Of Electronics and Communication Engineering
ADCON1: A/D CONTROL REGISTER 1
The ADCON1 register, shown below, configures the functions of the port pins.
bit 7-6 Unimplemented: Read as ‘0’
bit 5 VCFG0: Voltage Reference Configuration bit (VREF- source)
1 = VREF- (AN2)
0 = VSS
bit 4 VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = VREF+ (AN3)
0 = VDD
bit 3-0 PCFG3:PCFG0: A/D Port Configuration Control bits:
PC-BASED DIGITAL OSCILLOSCOPE
13 | P a g e Department Of Electronics and Communication Engineering
ADCON2: A/D CONTROL REGISTER 2
The ADCON2 register,shown below, configures the A/D clock source, programmed
acquisition time and justification
bit 7 ADFM: A/D Result Format Select bit
1 = Right justified
0 = Left justified
bit 6 Unimplemented: Read as ‘0’
bit 5-3 ACQT2:ACQT0: A/D Acquisition Time
Select bits
111 = 20 TAD
110 = 16 TAD
101 = 12 TAD
100 = 8 TAD
011 = 6 TAD
010 = 4 TAD
001 = 2 TAD
000 = 0 TAD(1)
Overview of the HID USB Peripheral
The PIC18FX455/X550 device family contains a full-speed and low-speed compatible
USB Serial Interface Engine (SIE) that allows fast communication between any USB host and
the PIC microcontroller. The SIE can be interfaced directly to the USB, utilizing the internal
transceiver, or it can be connected through an external transceiver. An internal 3.3V
regulator is also available to power the internal transceiver in 5V applications. Some special
hardware features have been included to improve performance. Dual port memory in the
device’s data memory space (USB RAM) has been supplied to share direct memory access
between the microcontroller core and the SIE. Buffer descriptors are also provided, allowing
users to freely program endpoint memory usage within the USB RAM space. A Streaming
Parallel Port has been provided to support the uninterrupted transfer of large volumes of
data, such as isochronous data, to external memory buffers.
bit 2-0 ADCS2:ADCS0: A/D Conversion Clock
Select bits
111 = FRC (clock derived from A/D RC
oscillator)(1)
110 = FOSC/64
101 = FOSC/16
100 = FOSC/4
011 = FRC (clock derived from A/D RC
oscillator)(1)
010 = FOSC/32
001 = FOSC/8
000 = FOSC/2
PC-BASED DIGITAL OSCILLOSCOPE
14 | P a g e Department Of Electronics and Communication Engineering
HARDWARE DEVELOPMENT
SIMPLIFIED BLOCK DIAGRAM
CURRENT
Measurment
ADC (10 bit
resolution)
Personal
Computer
PIC18F2550
MICROCONTROLLER
Oscillosco
pe
PROBE
ANALOG
CIRCUITRY
(vertical lift)
RESISTANCE
Measuremen
t
CAPACITANCE
Measurement
OSCILLOSCOPE
VOLTAGE
Measureme
nt
PROBE
SELECTION
USB interface
PC-BASED DIGITAL OSCILLOSCOPE
15 | P a g e Department Of Electronics and Communication Engineering
DESCRIPTION
Measurement of Capacitance
Time-constant method.
If a direct voltage is suddenly applied to the series combination of a resistor and an
initially discharged capacitor, the charge and the voltage on the capacitor increase
exponentially toward their full magnitudes with a time constant equal in seconds to the
product of the resistance in ohms and the capacitance in farads. Similarly, when a charged
capacitor is discharged through a resistor, the charge and the voltage decay with the same
time constant. Various methods are available for the measurement of capacitance by
measurement of the time constant of charge or discharge through a known resistor.
In one such method the time required for the output voltage of an operational
amplifier having a capacitor as a feedback component to increase to a value equal to the
step-function input voltage applied through a resistor to its input is determined by an
electronic voltage-comparison circuit and timer. With the assumption of ideal characteristics
for the amplifier, such as infinite gain without feedback, infinite input impedance, and zero
output impedance, the measured time interval is equal to the product of the values of the
known resistance and the capacitance being measured. See also Operational amplifier.
Measurement of Resistance
PC-BASED DIGITAL OSCILLOSCOPE
16 | P a g e Department Of Electronics and Communication Engineering
Resistance measurement is done using the principle of Potential divider circuit. The
resistance of an unknown resistor can be calculated by measuring the voltage across it when
it is kept series in a potential divider circuit by the Equation given below.
If Vt is the total voltage, Vx the voltage across unknown resistor R2and Vk across the
Known resistor R1, then R2 is given by
R2 =( Vt - Vx)*R1/Vk
Measurement of Current
Essentially, most of today’s ammeters are based on the fundamental theory of
electricity, Ohm’s law. Modern ammeters are essentially voltmeters with a precision
resistor, and using Ohm’s law, an accurate yet cost-effective measurement can be made.
Ohm’s Law – Ohm’s law states that, in an electrical circuit, the current passing through a
conductor between two points is directly proportional to the potential difference (in other
words, voltage drop or voltage) across the two points, and inversely proportional to the
resistance between them.
The mathematical equation that describes this relationship is:
I = V/R
where I is the current in amperes, V is the potential difference between two points of
interest in volts, and R is a circuit parameter, measured in ohms (which is equivalent to volts
per ampere), called the resistance.
Ammeter Operation – Today’s ammeters have an internal resistance to measure the current
across the particular signal. However, when the internal resistance is not enough to
measure larger currents, an external configuration is needed.
To measure larger currents, you can place a precision resistor called a shunt in parallel with
the meter. Most of the current flows through the shunt, and only a small fraction flows
through the meter. This allows the meter to measure larger currents.
Any resistor is acceptable, as long as the maximum expected current multiplied by the
resistance does not exceed the input range of the ammeter or data acquisition device.
When measuring current in this fashion, you should use the smallest value resistor possible
because this creates the smallest interference with the existing circuit. However, smaller
resistances create smaller voltage drops, so you must make a compromise between
resolution and circuit interference.
Given Figure shows a common schematic of current measurement across a shunt resistor.
PC-BASED DIGITAL OSCILLOSCOPE
17 | P a g e Department Of Electronics and Communication Engineering
Connecting a Shunt Resistor to a Measurement
Using this approach, the current is not actually directed into the ammeter/data acquisition
board but instead through an external shunt resistor. The largest current we can measure is
theoretically limitless, provided the voltage drop across the shunt resistor does not exceed
the working voltage range of the ammeter/data acquisition board.
PC-BASED DIGITAL OSCILLOSCOPE
18 | P a g e Department Of Electronics and Communication Engineering
DIGITAL CIRCUIT DIAGRAM
PC-BASED DIGITAL OSCILLOSCOPE
19 | P a g e Department Of Electronics and Communication Engineering
FLOWCHART
Initialize
Ports
Read Pin2
and Pin3
Output To
PC
Set Pin 12
=1
Read Port
4,5
Start
Timer
If Voltage
=3.14V
If scope
mode=1
Read timer
Value
If Pin 11
= 0
start
Stop
Timer
yes
yes
NO NO
yes
NO
PC-BASED DIGITAL OSCILLOSCOPE
20 | P a g e Department Of Electronics and Communication Engineering
THE SCOPE PROGRAM
PIC PROGRAMME
#define SCOPE_MODE PORTA.F4
#define CH1_PIN 0
#define CH2_PIN 1
#define CURRENT_PIN 2
#define RESISTANCE_PIN 3
#define BUTTON_CAPMEASSURE PORTC.F0
#define PIN_CAPMEASURE PORTC.F1
#define ADC_CAPMEASURE 4
unsigned char k, adcRes;
unsigned char userWR_buffer[64];
char *text = "MIKROElektronika Compilers ER rn";
void interrupt()
{
HID_InterruptProc();
}
void Init_Main()
{
INTCON = 0;
INTCON2 = 0xF5;
INTCON3 = 0xC0;
RCON.IPEN = 0;
PIE1 = 0;
PIE2 = 0;
PIR1 = 0;
PIR2 = 0;
ADCON1 = 0B00001000 ;
CMCON |= 7;
TRISA = 0xFF;
TRISB = 0;
TRISC = 0B11111101;
LATA = 0xFF;
LATB = 0;
LATC = 0B11111101;
}
void main()
{
char i;
TRISB = 0;
Init_Main();
HID_Enable(&userWR_buffer, &userWR_buffer);
PC-BASED DIGITAL OSCILLOSCOPE
21 | P a g e Department Of Electronics and Communication Engineering
Delay_ms(1000);
Delay_ms(1000);
while(1)
{
if(SCOPE_MODE)
{
userWR_buffer[0]= ADC_Read(CH1_PIN)>>2;
while (!HID_Write(&userWR_buffer, 1));
}
else
{
userWR_buffer[0] = 'C';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'U';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'R';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] =Adc_Read(CURRENT_PIN)>>2;
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'R';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'E';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'S';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] =Adc_Read(RESISTANCE_PIN)>>2;
while (!HID_Write(&userWR_buffer, 1));
Delay_Ms(50);
if(BUTTON_CAPMEASSURE == 0)
{
// Wait 1 second
Delay_Ms(1000);
PIN_CAPMEASURE = 1;
// Turn On Timer1
PIR1.TMR1IF = 0;
PIE1.TMR1IE = 0;
T1CON = 0B00110100;
TMR1L = 0;
TMR1H = 0;
T1CON.TMR1ON = 1;
// Measure voltages level reaches until 3.14V (ie 155)
while(1)
{
adcRes = ADC_Read(ADC_CAPMEASURE) >> 2;
if(adcRes >= 155)
{
// Stop Timer1
T1CON.TMR1ON = 0;
userWR_buffer[0] = 'C';
PC-BASED DIGITAL OSCILLOSCOPE
22 | P a g e Department Of Electronics and Communication Engineering
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = 'A';
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] = TMR1L;
while (!HID_Write(&userWR_buffer, 1));
userWR_buffer[0] =TMR1H;
while (!HID_Write(&userWR_buffer, 1));
PIN_CAPMEASURE = 0;
break;
}
if(PIR1.TMR1IF)
{
T1CON.TMR1ON = 0;
PIR1.TMR1IF = 0;
break;
}
}
}
}
}
Delay_ms(1000);
HID_Disable();
}
PC-BASED DIGITAL OSCILLOSCOPE
23 | P a g e Department Of Electronics and Communication Engineering
VISUAL BASIC GUI PROGRAM CODE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UsbLibrary;
using Microsoft.VisualBasic;
namespace UsbApp
{
public partial class Sniffer : Form
{
Bitmap bmp = new Bitmap(800, 800);
Color PlotColor = Color.Yellow;
int X, Y;
byte buff0, buff1, buff2, buff3;
public Sniffer()
{
InitializeComponent();
}
private void usb_OnDeviceArrived(object sender, EventArgs e)
{
this.lb_message.Items.Add("Found a Device");
toolStripStatusLabel1.Text = "Found a Device";
}
private void usb_OnDeviceRemoved(object sender, EventArgs e)
{
if (InvokeRequired)
{
Invoke(new EventHandler(usb_OnDeviceRemoved), new object[] { sender, e });
}
else
{
this.lb_message.Items.Add("Device was removed");
toolStripStatusLabel1.Text = "Device was removed";
}
}
private void usb_OnSpecifiedDeviceArrived(object sender, EventArgs e)
{
this.lb_message.Items.Add("PCScope was found");
toolStripStatusLabel1.Text = "PCScope was found";
PC-BASED DIGITAL OSCILLOSCOPE
24 | P a g e Department Of Electronics and Communication Engineering
//setting string form for sending data
string text = "";
for (int i = 0; i < this.usb.SpecifiedDevice.OutputReportLength - 1; i++)
{
text += "000 ";
}
this.tb_send.Text = text;
}
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
usb.RegisterHandle(Handle);
}
protected override void WndProc(ref Message m)
{
usb.ParseMessages(ref m);
base.WndProc(ref m); // pass message on to base form
}
private void btn_ok_Click(object sender, EventArgs e)
{
try
{
this.usb.ProductId = Int32.Parse(this.tb_product.Text,
System.Globalization.NumberStyles.HexNumber);
this.usb.VendorId = Int32.Parse(this.tb_vendor.Text,
System.Globalization.NumberStyles.HexNumber);
this.usb.CheckDevicePresent();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btn_send_Click(object sender, EventArgs e)
{
try
{
string text = this.tb_send.Text + " ";
text.Trim();
string[] arrText = text.Split(' ');
byte[] data = new byte[arrText.Length];
for (int i = 0; i < arrText.Length; i++)
{
if (arrText[i] != "")
{
int value = Int32.Parse(arrText[i], System.Globalization.NumberStyles.Number);
data[i] = (byte)Convert.ToByte(value);
}
}
PC-BASED DIGITAL OSCILLOSCOPE
25 | P a g e Department Of Electronics and Communication Engineering
if (this.usb.SpecifiedDevice != null)
{
this.usb.SpecifiedDevice.SendData(data);
}
else
{
MessageBox.Show("Sorry but your device is not present. Plug it in!! ");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void usb_OnSpecifiedDeviceRemoved(object sender, EventArgs e)
{
if (InvokeRequired)
{
Invoke(new EventHandler(usb_OnSpecifiedDeviceRemoved), new object[] { sender, e });
}
else
{
this.lb_message.Items.Add("PCScope was removed");
toolStripStatusLabel1.Text = "PCScope was removed";
}
}
private void usb_OnDataRecieved(object sender, DataRecievedEventArgs args)
{
try
{
if (InvokeRequired)
{
try
{
Invoke(new DataRecievedEventHandler(usb_OnDataRecieved), new object[] { sender,
args });
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
else
{
string rec_data = "";//"Data: ";
foreach (byte myData in args.data)
{
ProcessByte(myData);
rec_data = myData.ToString();
//MessageBox.Show(rec_data , "Char");
PC-BASED DIGITAL OSCILLOSCOPE
26 | P a g e Department Of Electronics and Communication Engineering
/* if (myData.ToString().Length == 1)
{
rec_data += "00";
}
if (myData.ToString().Length == 2)
{
rec_data += "0";
}
rec_data = rec_data + myData.ToString(); //+" ";*/
rec_data += Strings.Chr(myData);
}
this.lb_read.Items.Insert(0, rec_data);
if (lb_read.Items.Count > 1000) lb_read.Items.Clear();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void ProcessByte(byte theByte)
{
try
{
int vADC;
if (Tab.SelectedIndex == 0)
{
try
{
this.Y = 255-theByte; // Received Value
if (this.Y >= 500) this.Y = 500;
bmp.SetPixel(this.X, this.Y, PlotColor);
if (this.Y > 0) vADC = this.Y;
picScope.Image = bmp;
this.X = this.X + 1;
if (this.X >= 500)
{
bmp.Dispose();
bmp = new Bitmap(800, 800);
picScope.Image = bmp;
X = 1;
}
}
catch (Exception ex)
{
PC-BASED DIGITAL OSCILLOSCOPE
27 | P a g e Department Of Electronics and Communication Engineering
toolStripStatusLabel1.Text = "Error Occured: " + ex.Message;
}
}
else if (Tab.SelectedIndex == 1)
{
if (theByte != 0)
{
buff0 = buff1;
buff1 = buff2;
buff2 = buff3;
buff3 = theByte;
}
// Current / Capaciance ?
if (buff0 == Strings.Asc('C'))
{
try
{
if (buff1 == Strings.Asc('U') && buff2 == Strings.Asc('R'))
{
// Calculate and display Capacitance
lblCurrent.Text = "CURRENT: " + Strings.Format(buff3 * 0.01961, "0.00");
Application.DoEvents();
}
}
catch (Exception ex) { }
try
{
if (buff1 == Strings.Asc('A'))
{
// Calculate and display capacitance
double cap = (buff3 * 256) + buff2;
lblCapacitance.Text = "CAPACITANCE: " + Strings.Format(buff3 * 0.01961, "0.00");
Application.DoEvents();
}
}
catch (Exception ex) { }
}
else if (buff0 == Strings.Asc('R'))
{
try
{
if (buff1 == Strings.Asc('E') && buff2 == Strings.Asc('S'))
{
// Calculate and display resistance
lblResistance.Text = "RESISTANCE: " + Strings.Format(buff3 * 0.01961, "0.00");
Application.DoEvents();
}
}
catch (Exception ex) { }
}
}
}
catch (Exception ex)
{
PC-BASED DIGITAL OSCILLOSCOPE
28 | P a g e Department Of Electronics and Communication Engineering
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
return;
}
private void usb_OnDataSend(object sender, EventArgs e)
{
this.lb_message.Items.Add("Some data was send");
toolStripStatusLabel1.Text = "Some data was send";
}
private void Sniffer_Load(object sender, EventArgs e)
{
try {
toolStripStatusLabel1.Text = "Scanning for device";
} catch (Exception ex) {
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
btn_ok_Click(sender, e);
}
private void button5_Click(object sender, EventArgs e)
{
MessageBox.Show("Under Contruction");
}
private void button6_Click(object sender, EventArgs e)
{
MessageBox.Show("Under Contruction");
}
private void button7_Click(object sender, EventArgs e)
{
MessageBox.Show("Under Contruction");
}
private void button8_Click(object sender, EventArgs e)
{
MessageBox.Show("Under Contruction");
}
private void button3_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = Application.StartupPath + "resps.exe";
PC-BASED DIGITAL OSCILLOSCOPE
29 | P a g e Department Of Electronics and Communication Engineering
proc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source);
}
}
private void button4_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = Application.StartupPath + "resps.exe";
proc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = Application.StartupPath + "resps.exe";
proc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source);
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = Application.StartupPath + "resps.exe";
proc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source);
}
}
private void button9_Click(object sender, EventArgs e)
PC-BASED DIGITAL OSCILLOSCOPE
30 | P a g e Department Of Electronics and Communication Engineering
{
try {
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = Application.StartupPath + "resistance.exe";
proc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.Source);
}
}
private void TabPage1_Click(object sender, EventArgs e)
{
}
}
}
PC-BASED DIGITAL OSCILLOSCOPE
31 | P a g e Department Of Electronics and Communication Engineering
FUTURE WORK
Clearly there is a lot of additional development work that can be done to improve
the design of this low cost PC-based quad channel real-time / storage oscilloscope. This
chapter will briefly highlight areas of the design that merits improvement and additional
features to make the scope more powerful, reliable, flexible, and commercially
marketability.
Control Protocol
Obviously the first thing that needs to be finished, is the control protocol allowing
for the scope program to directly control the sample rate, enable / disable channels, real-
time / storage mode, chop or alternate, etc… .
Storage Mode
Sample a finite number of samples storing them into RAM. Once the memory is full
(or the preset number of samples has been reached) the PIC will stop sampling and transfer
the data to the PC, when ACK (acknowledgement) is received from the PC the PIC will start
sampling again. There is enough information contained in this report to implement this
feature, clearly the scope program and PIC software needs modification.
TCP / IP Internet Communications
Remote monitoring / control of oscilloscope from anywhere in world, for example
the machine actually connected to the scope hardware (running in slave mode) relays real-
time data through the internet using the TCP / IP internet protocol, the scope program on
the other end (master program), receives the data and draws the waveforms as normal. The
scope program operating in slave mode has its controls disabled, hence only the master
scope program controls the PIC, via the internet and via the slave scope program. Problem
the internet (unless using broadband technology, e.g. ASDL, fibre optic) is slow and
commonly suffers from net congestion, hence this feature is only useful for slow sampling
rates, unless storage mode is used. For example an ECG signal only requires a sample rate of
120 Hz, clearly the internet is capable of transferring this data in real-time without any
problems, hence a doctor can remotely diagnosis an ECG signal in real-time.
PC-BASED DIGITAL OSCILLOSCOPE
32 | P a g e Department Of Electronics and Communication Engineering
SUMMARY AND CONCLUSION
FEATURES
 Displays on PC various analog waveforms like
1) Sine
2) Triangular
3) rectangular
 Computes and display circuit parameters like
1) Capacitance
2) Voltage
3) Resistance
4) Current
 Plug and play USB interface to PC
Main Advantages of Digital over Analogue Scopes
• The ability to observe slow and very slow signals as a solid presentation on the screen.
 The PCBO has a very interactive GUI making it more convenient to use than conventional
oscilloscopes.
 The circuit is extremely cheap and easy to make.
Possible Applications For This Pc Based Oscilloscope: -
 Monitoring of sound waves, which are difficult to monitor on a traditional
oscilloscope due to the low frequencies involved.
 Monitoring of an ECG signal, again because this is such a low frequency traditional
oscilloscopes would have difficultly monitoring such a signal. ECG data could be
logged and emailed directly to the doctor for diagnosis, or perhaps real-time TCP/IP
internet communication so that the doctor could remotely monitor the ECG signal in
real-time.
 Monitoring of serial communications, for example RS485 works on the principal of
differential voltages between two cables twisted together; hence the PC based
oscilloscope could be used to view serial communications. Two oscilloscope channels
would be used, and the PC software will automatically add the two channels
together producing a virtual trace (A+B). Note this PC based oscilloscope is also
suitable for RS422 communication where there are separate transmit and receive
lines (2 sets of differential twisted par cables), hence all four scope channels can be
used producing two virtual traces (VC1 = CH1 + CH2, VC2 = CH3 + CH4). This
monitoring of serial communication is extremely useful for educational usage (e.g.
learning how serial data is transmitted).
PC-BASED DIGITAL OSCILLOSCOPE
33 | P a g e Department Of Electronics and Communication Engineering
 The PC based oscilloscope is ideal for demonstration purposes, for example using
data projector a class of student could be introduced to the oscilloscope, with real
waveforms being monitored (signal generator, or even a microphone for sound
waves) and displayed on a large projector display.
 Because of the low cost of the PC based oscilloscope, it is economical for a school /
technical college to have large quantities available for students. Unlike traditional
analogue scopes which are expensive and students are forced to share equipment,
because it is not economical to purchase enough scopes for every student.
PC-BASED DIGITAL OSCILLOSCOPE
34 | P a g e Department Of Electronics and Communication Engineering
REFERENCES
 http://xoscope.sourceforge.net
 http://www.datasheetcatalog.com/datasheets_pdf/A/D/C/0/ADC0804.shtml
 http://www.datasheetcatalog.com/datasheets_pdf/7/4/L/S/74LS245.shtml
 http://parapin.sourceforge.net/doc/parapin.html
 http://tomcat.apache.org/download-55.cgi
 http://www.codecomments.com/archive248-2004-4-182225.html
 http://www.stardeveloper.com/articles/display.html?article=2003090401&page=1
 http://www.frank-buss.de/echoservlet/
 http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
 http://www.dgp.toronto.edu/~mjmcguff/learn/java/07-backbuffer/
 The Complete Reference JAVA 2 By Herbert Schildt, McGraw Hill Publishers.
 http://www.j-nine.com/pubs/applet2servlet/index.htm
 http://forum.java.sun.com/thread.jspa?forumID=48&threadID=391594
 http://forums.fedoraforum.org/showthread.php?t=47591&highlight=tomcat
 http://www.developer.com/java/data/article.php/3417381
 http://www.sci.usq.edu.au/staff/leighb/graph/
 http://javaboutique.internet.com/educational/
 http://tecfa.unige.ch/guides/java/staf2x/ex/jdbc/coffee-break/
 http://javaboutique.internet.com/SimplePlot/source.html
 http://www.csupomona.edu/~pbsiegel/www/stujav.html
 http://servlets.com/jservlet2/examples/ch10/index.html

More Related Content

Similar to digital-oscilloscope 8051 Microcontroller.docx

Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...inventionjournals
 
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...inventionjournals
 
Cro cathode ray oscilloscope working and applications
Cro cathode ray oscilloscope working and applicationsCro cathode ray oscilloscope working and applications
Cro cathode ray oscilloscope working and applicationsEdgefxkits & Solutions
 
ARM Based Handy and Portable Oscilloscope Using Graphical Display
ARM Based Handy and Portable Oscilloscope Using Graphical DisplayARM Based Handy and Portable Oscilloscope Using Graphical Display
ARM Based Handy and Portable Oscilloscope Using Graphical DisplayIJERA Editor
 
cathode ray oscilloscope &function generator
cathode ray oscilloscope &function generatorcathode ray oscilloscope &function generator
cathode ray oscilloscope &function generatormegha agrawal
 
Emi lab manual_vthsem_ece
Emi lab manual_vthsem_eceEmi lab manual_vthsem_ece
Emi lab manual_vthsem_eceAshish Duvey
 
Ekeeda - Instrumentation Engineering
Ekeeda - Instrumentation EngineeringEkeeda - Instrumentation Engineering
Ekeeda - Instrumentation EngineeringEkeedaPvtLtd
 
Handheld oscilloscopes, dso nano v3
Handheld oscilloscopes, dso nano v3Handheld oscilloscopes, dso nano v3
Handheld oscilloscopes, dso nano v3Md. Tosir Uddin
 
Cathode Ray Oscilloscope
Cathode Ray OscilloscopeCathode Ray Oscilloscope
Cathode Ray Oscilloscoperajainayat
 
Lec 8,9,10 (interfacing)
Lec 8,9,10 (interfacing)Lec 8,9,10 (interfacing)
Lec 8,9,10 (interfacing)Mohamed Atef
 
Radio Astronomy and electronics
Radio Astronomy and electronicsRadio Astronomy and electronics
Radio Astronomy and electronicsFlavio Falcinelli
 
Development of Compact P-Band Vector Reflectometer
Development of Compact P-Band Vector Reflectometer Development of Compact P-Band Vector Reflectometer
Development of Compact P-Band Vector Reflectometer IJECEIAES
 
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITY
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITYELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITY
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITYEldhose George
 
Ac lab final_report
Ac lab final_reportAc lab final_report
Ac lab final_reportGeorge Cibi
 

Similar to digital-oscilloscope 8051 Microcontroller.docx (20)

Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
 
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
Method Of Measuring Projections Multi Function Using The Quick And Accurate O...
 
Oscilloscope
OscilloscopeOscilloscope
Oscilloscope
 
Cro cathode ray oscilloscope working and applications
Cro cathode ray oscilloscope working and applicationsCro cathode ray oscilloscope working and applications
Cro cathode ray oscilloscope working and applications
 
Lab LCA 1 7
Lab LCA 1 7Lab LCA 1 7
Lab LCA 1 7
 
ARM Based Handy and Portable Oscilloscope Using Graphical Display
ARM Based Handy and Portable Oscilloscope Using Graphical DisplayARM Based Handy and Portable Oscilloscope Using Graphical Display
ARM Based Handy and Portable Oscilloscope Using Graphical Display
 
cathode ray oscilloscope &function generator
cathode ray oscilloscope &function generatorcathode ray oscilloscope &function generator
cathode ray oscilloscope &function generator
 
Be lab manual csvtu
Be lab manual csvtuBe lab manual csvtu
Be lab manual csvtu
 
Emi lab manual_vthsem_ece
Emi lab manual_vthsem_eceEmi lab manual_vthsem_ece
Emi lab manual_vthsem_ece
 
Ekeeda - Instrumentation Engineering
Ekeeda - Instrumentation EngineeringEkeeda - Instrumentation Engineering
Ekeeda - Instrumentation Engineering
 
Handheld oscilloscopes, dso nano v3
Handheld oscilloscopes, dso nano v3Handheld oscilloscopes, dso nano v3
Handheld oscilloscopes, dso nano v3
 
Flow measurement
Flow measurementFlow measurement
Flow measurement
 
Oscilloscope
OscilloscopeOscilloscope
Oscilloscope
 
Cathode Ray Oscilloscope
Cathode Ray OscilloscopeCathode Ray Oscilloscope
Cathode Ray Oscilloscope
 
Lec 8,9,10 (interfacing)
Lec 8,9,10 (interfacing)Lec 8,9,10 (interfacing)
Lec 8,9,10 (interfacing)
 
Radio Astronomy and electronics
Radio Astronomy and electronicsRadio Astronomy and electronics
Radio Astronomy and electronics
 
unit 4.pdf
unit 4.pdfunit 4.pdf
unit 4.pdf
 
Development of Compact P-Band Vector Reflectometer
Development of Compact P-Band Vector Reflectometer Development of Compact P-Band Vector Reflectometer
Development of Compact P-Band Vector Reflectometer
 
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITY
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITYELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITY
ELECTRONICS PROJECT REPORT OF HOME AUTOMATION CUM BUILDING SECUIRITY
 
Ac lab final_report
Ac lab final_reportAc lab final_report
Ac lab final_report
 

Recently uploaded

Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gapedkojalkojal131
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...Pooja Nehwal
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...Suhani Kapoor
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...anilsa9823
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...Pooja Nehwal
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...Call Girls in Nagpur High Profile
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...Naicy mandal
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)kojalkojal131
 
Thane Escorts, (Pooja 09892124323), Thane Call Girls
Thane Escorts, (Pooja 09892124323), Thane Call GirlsThane Escorts, (Pooja 09892124323), Thane Call Girls
Thane Escorts, (Pooja 09892124323), Thane Call GirlsPooja Nehwal
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...tanu pandey
 
presentation about microsoft power point
presentation about microsoft power pointpresentation about microsoft power point
presentation about microsoft power pointchhavia330
 
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...Suhani Kapoor
 
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Top Rated Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...Pooja Nehwal
 

Recently uploaded (20)

Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
Lucknow 💋 Call Girls Adil Nagar | ₹,9500 Pay Cash 8923113531 Free Home Delive...
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
 
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...
Makarba ( Call Girls ) Ahmedabad ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Rea...
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
 
Thane Escorts, (Pooja 09892124323), Thane Call Girls
Thane Escorts, (Pooja 09892124323), Thane Call GirlsThane Escorts, (Pooja 09892124323), Thane Call Girls
Thane Escorts, (Pooja 09892124323), Thane Call Girls
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
 
presentation about microsoft power point
presentation about microsoft power pointpresentation about microsoft power point
presentation about microsoft power point
 
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Bhavna Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
 
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
 
Top Rated Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Ravet ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
 

digital-oscilloscope 8051 Microcontroller.docx

  • 1. PC-BASED DIGITAL OSCILLOSCOPE 1 | P a g e Department Of Electronics and Communication Engineering MAIN PROJECT REPORT ON PC-BASED DIGITAL OSCILLOSCOPE USING PIC MICROCONTROLER
  • 2. PC-BASED DIGITAL OSCILLOSCOPE 2 | P a g e Department Of Electronics and Communication Engineering ABSTRACT The digital oscilloscope attempts to achieve the same functionality as a traditional oscilloscope, using a PIC microcontroller for data acquisition (including appropriate analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based software application will then display the waveform as it would appear on a traditional CRT oscilloscope. This software application will have additional features not present on a traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional features can be added as their developed without the need for new hardware. Additional function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to measure the circuit parameters like capacitance, resistance, current and voltage of the required component.
  • 3. PC-BASED DIGITAL OSCILLOSCOPE 3 | P a g e Department Of Electronics and Communication Engineering TABLE OF CONTENTS 1. INTRODUCTION......................................................................................... 4 2. FUNDEMENTALS........................................................................................ 5 2.1 THE BASIC CRT OSCILLOSCOPE............................................................................................... 5 2.2 DIGITAL SAMPLING OSCILLOSCOPES ...................................................................................... 7 2.3 THE PIC MICROCONTROLLER.................................................................................................. 8 2.4 UNIVERSAL SERIAL BUS INTERFACE ....................................................................................10 3. THE PIC18F2550 MICROCONTROLLER ...................................................... 11 3.1 OVERVIEW OF THE 8-CHANNEL 10-BIT ADC...........................................................................12 3.2 OVERVIEW OF THE HID USB PERIPHERAL...............................................................................13 4. HARDWARE DEVELOPMENT ................................................................... 14 5.1 SIMPLIFIED BLOCK DIAGRAM .................................................................................................14 5.2 DESCRIPTION ..........................................................................................................................15 5.3 DIGITAL CIRCUIT DIAGRAM ....................................................................................................18 5.4 FLOWCHART............................................................................................................................19 5. THE SCOPE PROGRAM............................................................................. 20 6.1 PIC PROGRAMME...................................................................................................................20 6.2 VISUAL BASIC PROGRAM CODE .............................................................................................23 6. FUTURE WORK ....................................................................................... 31 7. SUMMARY AND CONCLUSION................................................................ 32 8. REFERENCES ........................................................................................... 34
  • 4. PC-BASED DIGITAL OSCILLOSCOPE 4 | P a g e Department Of Electronics and Communication Engineering INTRODUCTION An oscilloscope is a type of electronic test instrument that allows signal voltages to be viewed, usually as a two-dimensional graph of one or more electrical potential differences (vertical(Y) axis) plotted as a function of time or of some other voltage (horizontal(x) axis). Although an oscilloscope displays voltage on its vertical axis, any other quantity that can be converted to a voltage can be displayed as well. In most instances, oscilloscopes show events that repeat with either no change, or change slowly. The oscilloscope is one of the most versatile and widely-used electronic instruments. Oscilloscopes are commonly used when it is desired to observe the exact wave shape of an electrical signal. In addition to the amplitude of the signal, an oscilloscope can show distortion and measure frequency, time between two events (such as pulse width or pulse rise time), and relative timing of two related signals. Some modern digital oscilloscopes can analyze and display the spectrum of a repetitive event The digital oscilloscope attempts to achieve the same functionality as a traditional oscilloscope, using a PIC microcontroller for data acquisition (including appropriate analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based software application will then display the waveform as it would appear on a traditional CRT oscilloscope. This software application will have additional features not present on a traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional features can be added as their developed without the need for new hardware. Additional function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to measure the circuit parameters like capacitance, resistance, current and voltage of the required component. Digital oscilloscopes have two main advantages over traditional analogue scopes: - 1. The ability to observe slow and very slow signals as a solid presentation on the screen. Slow moving signals in the 10-100 Hz range are difficult to see and measure on a normal analogue oscilloscope due to the flicker of the trace and the short persistence of the spot on the screen. 2. The ability to hold or retain a signal in memory for long periods. The PIC microcontroller has a built-in ADC (8, 10 or 12 bits) which has a voltage range of 0 to 5V. This voltage range is not ideal as most oscilloscopes have a much wider voltage range including negative voltages (e.g. -100 to 100V); hence an analogue circuit is required to reduce the voltage positivee signals so they fall between 2.5 and 5V and voltage negative signals between 0 and 2.5V (i.e. bipolar). The built-in ADC on the PIC is slow and will limit the maximum sampling frequency; hence an external Flash ADC with direct memory access will be required to produce a high-performance digital storage oscilloscope (e.g. AD9070 – 10Bit, 100MSPS ADC)
  • 5. PC-BASED DIGITAL OSCILLOSCOPE 5 | P a g e Department Of Electronics and Communication Engineering 1. FUNDEMENTALS THE BASIC CRT OSCILLOSCOPE An oscilloscope draws its trace with a spot of light (produced by a deflectable beam of electrons) moving across the screen of its CRT. Basically an oscilloscope consists of the CRT, a ‘time base’ circuit to move the spot steadily from left to right across the screen at the appropriate time and speed, and some means (usually a ‘Y’ deflection amplifier) of enabling the signal to deflect the spot in the vertical or Y direction. This type of oscilloscope is known as a ‘real-time’ oscilloscope. This means that the vertical deflection of the spot on the screen at any instant is determined by the Y input voltage at that instant. The basic oscilloscope is typically divided into four sections: the display, vertical controls, horizontal controls and trigger controls. The display is usually a CRT or LCD panel which is laid out with both horizontal and vertical reference lines referred to as the graticule. In addition to the screen, most display sections are equipped with three basic controls, a focus knob, an intensity knob and a beam finder button. The vertical section controls the amplitude of the displayed signal. This section carries a Volts-per-Division (Volts/Div) selector knob, an AC/DC/Ground selector switch and the vertical (primary) input for the instrument. Additionally, this section is typically equipped with the vertical beam position knob.
  • 6. PC-BASED DIGITAL OSCILLOSCOPE 6 | P a g e Department Of Electronics and Communication Engineering The horizontal section controls the time base or “sweep” of the instrument. The primary control is the Seconds-per-Division (Sec/Div) selector switch. Also included is a horizontal input for plotting dual X-Y axis signals. The horizontal beam position knob is generally located in this section. The trigger section controls the start event of the sweep. The trigger can be set to automatically restart after each sweep or it can be configured to respond to an internal or external event. The principal controls of this section will be the source and coupling selector switches. An external trigger input (EXT Input) and level adjustment will also be included. In addition to the basic instrument, most oscilloscopes are supplied with a probe as shown. The probe will connect to any input on the instrument and typically has a resistor of ten times the 'scope's input impedance. This results in a .1 (-10X) attenuation factor, but helps to isolate the capacitive load presented by the probe cable from the signal being measured. Some probes have a switch allowing the operator to bypass the resistor when appropriate.
  • 7. PC-BASED DIGITAL OSCILLOSCOPE 7 | P a g e Department Of Electronics and Communication Engineering DIGITAL SAMPLING OSCILLOSCOPES Digital sampling oscilloscopes use an ADC (analogue-to-digital converter) to converter analogue voltages to binary representation. The sampling rate specifies the number of samples taken per second. Figure demonstrates clearly how an analogue wave- form is digitally sampled and displayed onto the screen (LCD, Computer Monitor, etc…). The PIC microcontroller has a built-in ADC (8, 10 or 12 bits) which has a voltage range of 0 to 5V. This voltage range is not ideal as most oscilloscopes have a much wider voltage range including negative voltages (e.g. -100 to 100V); hence an analogue circuit is required to reduce the voltage positive signals so they fall between 2.5 and 5V and voltage negative signals between 0 and 2.5V (i.e. bipolar). ANALOG CIRCUITRY
  • 8. PC-BASED DIGITAL OSCILLOSCOPE 8 | P a g e Department Of Electronics and Communication Engineering THE PIC MICROCONTROLLER A PIC (Peripheral Interface Controller) microcontroller is an IC manufactured by Microchip. These ICs are complete computers in a single package. The only external components necessary are whatever is required by the I/O devices that are connected to the PIC. PICs use the Harvard architecture. The Harvard architecture is an adaptation of the standard von Neumann structure with separate program and data memory: data memory is made up by a small number of 8-bit registers and program memory is 12 to 16-bits wide EPROM, FLASH or ROM. Traditional CISC (Complex Instruction Set Computer) machines (Used in: 80X86, 8051, 6800, 68000, etc…) have many instructions (usually > 100), many addressing modes and it usually takes more than 1 internal clock cycle to execute. PIC microcontrollers are RISC (Reduced Instruction Set Computer) machines, which have 33 (12-bit) to 58 (15-bit) instructions, reduced addressing modes (PICs have only direct and indirect), each instruction does less, but usually executes in one internal clock. A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80 instructions for the high-end PICs. The instruction set includes instructions to perform a variety of operations on registers directly, the accumulator and a literal constant or the accumulator and a register, as well as for conditional execution, and program branching. Some operations, such as bit setting and testing, can be performed on any numbered register, but bi-operand arithmetic operations always involve W (the accumulator) ; writing the result back to either W or the other operand register. To load a constant, it is necessary to load it into W before it can be moved into another register. On the older cores, all register moves needed to pass through W, but this changed on the "high end" cores. PIC cores have skip instructions which are used for conditional execution and branching. The skip instructions are: 'skip if bit set', and, 'skip if bit not set'. Because cores before PIC18 had only unconditional branch instructions, conditional jumps are implemented by a conditional skip (with the opposite condition) followed by an unconditional branch. Skips are also of utility for conditional execution of any immediate single following instruction.
  • 9. PC-BASED DIGITAL OSCILLOSCOPE 9 | P a g e Department Of Electronics and Communication Engineering The PIC architecture has no (or very meager) hardware support for automatically saving processor state when servicing interrupts. The 18 series improved this situation by implementing shadow registers which save several important registers during an interrupt. In general, PIC instructions fall into 5 classes:  Operation on W with 8-bit immediate ("literal") operand. E.g. movlw (move literal to W), andlw (AND literal with W). One instruction peculiar to the PIC is retlw, load immediate into W and return, which is used with computed branches to produce lookup tables.  Operation with W and indexed register. The result can be written to either the W register (e.g. addwf reg,w). or the selected register (e.g. addwf reg,f).  Bit operations. These take a register number and a bit number, and perform one of 4 actions: set or clear a bit, and test and skip on set/clear. The latter are used to perform conditional branches. The usual ALU status flags are available in a numbered register so operations such as "branch on carry clear" are possible.  Control transfers. Other than the skip instructions previously mentioned, there are only two: goto and call.  A few miscellaneous zero-operand instructions, such as return from subroutine, and sleep to enter low-power mode.
  • 10. PC-BASED DIGITAL OSCILLOSCOPE 10 | P a g e Department Of Electronics and Communication Engineering UNIVERSAL SERIAL BUS INTERFACE USB is a specification to establish communication between devices and a host controller (usually personal computers). A USB (Universal Serial Bus) system has an asymmetric design, consisting of a host, a multitude of downstream USB ports, and multiple peripheral devices connected in a tiered-star topology. Additional USB hubs may be included in the tiers, allowing branching into a tree structure with up to five tier levels. A USB host may have multiple host controllers and each host controller may provide one or more USB ports. Up to 127 devices, including hub devices if present may be connected to a single host controller. USB devices are linked in series through hubs. There always exists one hub known as the root hub, which is built into the host controller. So-called sharing hubs, which allow multiple computers to access the same peripheral device(s), also exist and work by switching access between PCs, either automatically or manually. Sharing hubs are popular in small-office environments. In network terms, they converge rather than diverge branches. A physical USB device may consist of several logical sub-devices that are referred to as device functions. A single device may provide several functions, for example, a webcam (video device function) with a built-in microphone (audio device function). Such a device is called a compound device in which each logical device is assigned a distinctive address by the host and all logical devices are connected to a built-in hub to which the physical USB wire is connected. A host assigns one and only one device address to a function. USB endpoints actually reside on the connected device: the channels to the host are referred to as pipes. USB device communication is based on pipes (logical channels). A pipe is a connection from the host controller to a logical entity, found on a device, and named an endpoint. The term endpoint is occasionally incorrectly used for referring to the pipe. However, while an endpoint exists on the device permanently, a pipe is only formed when the host makes a connection to the endpoint. Therefore, when referring to the connection between a host and an endpoint, the term pipe should be used. A USB device can have up to 32 active pipes: 16 into the host controller and 16 out of the host controller.
  • 11. PC-BASED DIGITAL OSCILLOSCOPE 11 | P a g e Department Of Electronics and Communication Engineering THE PIC18F2550 MICROCONTROLLER 10-BIT ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE The Analog-to-Digital (A/D) converter module has 10 inputs for the 28-pin devices and 13 for the40/44-pin devices. This module allows conversion of an analog input signal to a corresponding 10-bit digital number. The module has five registers: • A/D Result High Register (ADRESH) • A/D Result Low Register (ADRESL) • A/D Control Register 0 (ADCON0) • A/D Control Register 1 (ADCON1) • A/D Control Register 2 (ADCON2) ADCON0: A/D CONTROL REGISTER 0 The ADCON0 register, shown below, controls the operation of the A/D module. bit 7-6 Unimplemented: Read as ‘0’ bit 5-2 CHS3:CHS0: Analog Channel Select bits 0000 = Channel 0 (AN0) 0001 = Channel 1 (AN1) 0010 = Channel 2 (AN2) 0011 = Channel 3 (AN3) 0100 = Channel 4 (AN4) 0101 = Channel 5 (AN5)(1,2) 0110 = Channel 6 (AN6)(1,2) 0111 = Channel 7 (AN7)(1,2) 1000 = Channel 8 (AN8) bit 1 GO/DONE: A/D Conversion Status bit When ADON = 1: 1 = A/D conversion in progress 0 = A/D Idle bit 0 ADON: A/D On bit 1 = A/D converter module is enabled 0 = A/D converter module is disabled
  • 12. PC-BASED DIGITAL OSCILLOSCOPE 12 | P a g e Department Of Electronics and Communication Engineering ADCON1: A/D CONTROL REGISTER 1 The ADCON1 register, shown below, configures the functions of the port pins. bit 7-6 Unimplemented: Read as ‘0’ bit 5 VCFG0: Voltage Reference Configuration bit (VREF- source) 1 = VREF- (AN2) 0 = VSS bit 4 VCFG0: Voltage Reference Configuration bit (VREF+ source) 1 = VREF+ (AN3) 0 = VDD bit 3-0 PCFG3:PCFG0: A/D Port Configuration Control bits:
  • 13. PC-BASED DIGITAL OSCILLOSCOPE 13 | P a g e Department Of Electronics and Communication Engineering ADCON2: A/D CONTROL REGISTER 2 The ADCON2 register,shown below, configures the A/D clock source, programmed acquisition time and justification bit 7 ADFM: A/D Result Format Select bit 1 = Right justified 0 = Left justified bit 6 Unimplemented: Read as ‘0’ bit 5-3 ACQT2:ACQT0: A/D Acquisition Time Select bits 111 = 20 TAD 110 = 16 TAD 101 = 12 TAD 100 = 8 TAD 011 = 6 TAD 010 = 4 TAD 001 = 2 TAD 000 = 0 TAD(1) Overview of the HID USB Peripheral The PIC18FX455/X550 device family contains a full-speed and low-speed compatible USB Serial Interface Engine (SIE) that allows fast communication between any USB host and the PIC microcontroller. The SIE can be interfaced directly to the USB, utilizing the internal transceiver, or it can be connected through an external transceiver. An internal 3.3V regulator is also available to power the internal transceiver in 5V applications. Some special hardware features have been included to improve performance. Dual port memory in the device’s data memory space (USB RAM) has been supplied to share direct memory access between the microcontroller core and the SIE. Buffer descriptors are also provided, allowing users to freely program endpoint memory usage within the USB RAM space. A Streaming Parallel Port has been provided to support the uninterrupted transfer of large volumes of data, such as isochronous data, to external memory buffers. bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Select bits 111 = FRC (clock derived from A/D RC oscillator)(1) 110 = FOSC/64 101 = FOSC/16 100 = FOSC/4 011 = FRC (clock derived from A/D RC oscillator)(1) 010 = FOSC/32 001 = FOSC/8 000 = FOSC/2
  • 14. PC-BASED DIGITAL OSCILLOSCOPE 14 | P a g e Department Of Electronics and Communication Engineering HARDWARE DEVELOPMENT SIMPLIFIED BLOCK DIAGRAM CURRENT Measurment ADC (10 bit resolution) Personal Computer PIC18F2550 MICROCONTROLLER Oscillosco pe PROBE ANALOG CIRCUITRY (vertical lift) RESISTANCE Measuremen t CAPACITANCE Measurement OSCILLOSCOPE VOLTAGE Measureme nt PROBE SELECTION USB interface
  • 15. PC-BASED DIGITAL OSCILLOSCOPE 15 | P a g e Department Of Electronics and Communication Engineering DESCRIPTION Measurement of Capacitance Time-constant method. If a direct voltage is suddenly applied to the series combination of a resistor and an initially discharged capacitor, the charge and the voltage on the capacitor increase exponentially toward their full magnitudes with a time constant equal in seconds to the product of the resistance in ohms and the capacitance in farads. Similarly, when a charged capacitor is discharged through a resistor, the charge and the voltage decay with the same time constant. Various methods are available for the measurement of capacitance by measurement of the time constant of charge or discharge through a known resistor. In one such method the time required for the output voltage of an operational amplifier having a capacitor as a feedback component to increase to a value equal to the step-function input voltage applied through a resistor to its input is determined by an electronic voltage-comparison circuit and timer. With the assumption of ideal characteristics for the amplifier, such as infinite gain without feedback, infinite input impedance, and zero output impedance, the measured time interval is equal to the product of the values of the known resistance and the capacitance being measured. See also Operational amplifier. Measurement of Resistance
  • 16. PC-BASED DIGITAL OSCILLOSCOPE 16 | P a g e Department Of Electronics and Communication Engineering Resistance measurement is done using the principle of Potential divider circuit. The resistance of an unknown resistor can be calculated by measuring the voltage across it when it is kept series in a potential divider circuit by the Equation given below. If Vt is the total voltage, Vx the voltage across unknown resistor R2and Vk across the Known resistor R1, then R2 is given by R2 =( Vt - Vx)*R1/Vk Measurement of Current Essentially, most of today’s ammeters are based on the fundamental theory of electricity, Ohm’s law. Modern ammeters are essentially voltmeters with a precision resistor, and using Ohm’s law, an accurate yet cost-effective measurement can be made. Ohm’s Law – Ohm’s law states that, in an electrical circuit, the current passing through a conductor between two points is directly proportional to the potential difference (in other words, voltage drop or voltage) across the two points, and inversely proportional to the resistance between them. The mathematical equation that describes this relationship is: I = V/R where I is the current in amperes, V is the potential difference between two points of interest in volts, and R is a circuit parameter, measured in ohms (which is equivalent to volts per ampere), called the resistance. Ammeter Operation – Today’s ammeters have an internal resistance to measure the current across the particular signal. However, when the internal resistance is not enough to measure larger currents, an external configuration is needed. To measure larger currents, you can place a precision resistor called a shunt in parallel with the meter. Most of the current flows through the shunt, and only a small fraction flows through the meter. This allows the meter to measure larger currents. Any resistor is acceptable, as long as the maximum expected current multiplied by the resistance does not exceed the input range of the ammeter or data acquisition device. When measuring current in this fashion, you should use the smallest value resistor possible because this creates the smallest interference with the existing circuit. However, smaller resistances create smaller voltage drops, so you must make a compromise between resolution and circuit interference. Given Figure shows a common schematic of current measurement across a shunt resistor.
  • 17. PC-BASED DIGITAL OSCILLOSCOPE 17 | P a g e Department Of Electronics and Communication Engineering Connecting a Shunt Resistor to a Measurement Using this approach, the current is not actually directed into the ammeter/data acquisition board but instead through an external shunt resistor. The largest current we can measure is theoretically limitless, provided the voltage drop across the shunt resistor does not exceed the working voltage range of the ammeter/data acquisition board.
  • 18. PC-BASED DIGITAL OSCILLOSCOPE 18 | P a g e Department Of Electronics and Communication Engineering DIGITAL CIRCUIT DIAGRAM
  • 19. PC-BASED DIGITAL OSCILLOSCOPE 19 | P a g e Department Of Electronics and Communication Engineering FLOWCHART Initialize Ports Read Pin2 and Pin3 Output To PC Set Pin 12 =1 Read Port 4,5 Start Timer If Voltage =3.14V If scope mode=1 Read timer Value If Pin 11 = 0 start Stop Timer yes yes NO NO yes NO
  • 20. PC-BASED DIGITAL OSCILLOSCOPE 20 | P a g e Department Of Electronics and Communication Engineering THE SCOPE PROGRAM PIC PROGRAMME #define SCOPE_MODE PORTA.F4 #define CH1_PIN 0 #define CH2_PIN 1 #define CURRENT_PIN 2 #define RESISTANCE_PIN 3 #define BUTTON_CAPMEASSURE PORTC.F0 #define PIN_CAPMEASURE PORTC.F1 #define ADC_CAPMEASURE 4 unsigned char k, adcRes; unsigned char userWR_buffer[64]; char *text = "MIKROElektronika Compilers ER rn"; void interrupt() { HID_InterruptProc(); } void Init_Main() { INTCON = 0; INTCON2 = 0xF5; INTCON3 = 0xC0; RCON.IPEN = 0; PIE1 = 0; PIE2 = 0; PIR1 = 0; PIR2 = 0; ADCON1 = 0B00001000 ; CMCON |= 7; TRISA = 0xFF; TRISB = 0; TRISC = 0B11111101; LATA = 0xFF; LATB = 0; LATC = 0B11111101; } void main() { char i; TRISB = 0; Init_Main(); HID_Enable(&userWR_buffer, &userWR_buffer);
  • 21. PC-BASED DIGITAL OSCILLOSCOPE 21 | P a g e Department Of Electronics and Communication Engineering Delay_ms(1000); Delay_ms(1000); while(1) { if(SCOPE_MODE) { userWR_buffer[0]= ADC_Read(CH1_PIN)>>2; while (!HID_Write(&userWR_buffer, 1)); } else { userWR_buffer[0] = 'C'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'U'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'R'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] =Adc_Read(CURRENT_PIN)>>2; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'R'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'E'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'S'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] =Adc_Read(RESISTANCE_PIN)>>2; while (!HID_Write(&userWR_buffer, 1)); Delay_Ms(50); if(BUTTON_CAPMEASSURE == 0) { // Wait 1 second Delay_Ms(1000); PIN_CAPMEASURE = 1; // Turn On Timer1 PIR1.TMR1IF = 0; PIE1.TMR1IE = 0; T1CON = 0B00110100; TMR1L = 0; TMR1H = 0; T1CON.TMR1ON = 1; // Measure voltages level reaches until 3.14V (ie 155) while(1) { adcRes = ADC_Read(ADC_CAPMEASURE) >> 2; if(adcRes >= 155) { // Stop Timer1 T1CON.TMR1ON = 0; userWR_buffer[0] = 'C';
  • 22. PC-BASED DIGITAL OSCILLOSCOPE 22 | P a g e Department Of Electronics and Communication Engineering while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = 'A'; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] = TMR1L; while (!HID_Write(&userWR_buffer, 1)); userWR_buffer[0] =TMR1H; while (!HID_Write(&userWR_buffer, 1)); PIN_CAPMEASURE = 0; break; } if(PIR1.TMR1IF) { T1CON.TMR1ON = 0; PIR1.TMR1IF = 0; break; } } } } } Delay_ms(1000); HID_Disable(); }
  • 23. PC-BASED DIGITAL OSCILLOSCOPE 23 | P a g e Department Of Electronics and Communication Engineering VISUAL BASIC GUI PROGRAM CODE using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using UsbLibrary; using Microsoft.VisualBasic; namespace UsbApp { public partial class Sniffer : Form { Bitmap bmp = new Bitmap(800, 800); Color PlotColor = Color.Yellow; int X, Y; byte buff0, buff1, buff2, buff3; public Sniffer() { InitializeComponent(); } private void usb_OnDeviceArrived(object sender, EventArgs e) { this.lb_message.Items.Add("Found a Device"); toolStripStatusLabel1.Text = "Found a Device"; } private void usb_OnDeviceRemoved(object sender, EventArgs e) { if (InvokeRequired) { Invoke(new EventHandler(usb_OnDeviceRemoved), new object[] { sender, e }); } else { this.lb_message.Items.Add("Device was removed"); toolStripStatusLabel1.Text = "Device was removed"; } } private void usb_OnSpecifiedDeviceArrived(object sender, EventArgs e) { this.lb_message.Items.Add("PCScope was found"); toolStripStatusLabel1.Text = "PCScope was found";
  • 24. PC-BASED DIGITAL OSCILLOSCOPE 24 | P a g e Department Of Electronics and Communication Engineering //setting string form for sending data string text = ""; for (int i = 0; i < this.usb.SpecifiedDevice.OutputReportLength - 1; i++) { text += "000 "; } this.tb_send.Text = text; } protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); usb.RegisterHandle(Handle); } protected override void WndProc(ref Message m) { usb.ParseMessages(ref m); base.WndProc(ref m); // pass message on to base form } private void btn_ok_Click(object sender, EventArgs e) { try { this.usb.ProductId = Int32.Parse(this.tb_product.Text, System.Globalization.NumberStyles.HexNumber); this.usb.VendorId = Int32.Parse(this.tb_vendor.Text, System.Globalization.NumberStyles.HexNumber); this.usb.CheckDevicePresent(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void btn_send_Click(object sender, EventArgs e) { try { string text = this.tb_send.Text + " "; text.Trim(); string[] arrText = text.Split(' '); byte[] data = new byte[arrText.Length]; for (int i = 0; i < arrText.Length; i++) { if (arrText[i] != "") { int value = Int32.Parse(arrText[i], System.Globalization.NumberStyles.Number); data[i] = (byte)Convert.ToByte(value); } }
  • 25. PC-BASED DIGITAL OSCILLOSCOPE 25 | P a g e Department Of Electronics and Communication Engineering if (this.usb.SpecifiedDevice != null) { this.usb.SpecifiedDevice.SendData(data); } else { MessageBox.Show("Sorry but your device is not present. Plug it in!! "); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void usb_OnSpecifiedDeviceRemoved(object sender, EventArgs e) { if (InvokeRequired) { Invoke(new EventHandler(usb_OnSpecifiedDeviceRemoved), new object[] { sender, e }); } else { this.lb_message.Items.Add("PCScope was removed"); toolStripStatusLabel1.Text = "PCScope was removed"; } } private void usb_OnDataRecieved(object sender, DataRecievedEventArgs args) { try { if (InvokeRequired) { try { Invoke(new DataRecievedEventHandler(usb_OnDataRecieved), new object[] { sender, args }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } else { string rec_data = "";//"Data: "; foreach (byte myData in args.data) { ProcessByte(myData); rec_data = myData.ToString(); //MessageBox.Show(rec_data , "Char");
  • 26. PC-BASED DIGITAL OSCILLOSCOPE 26 | P a g e Department Of Electronics and Communication Engineering /* if (myData.ToString().Length == 1) { rec_data += "00"; } if (myData.ToString().Length == 2) { rec_data += "0"; } rec_data = rec_data + myData.ToString(); //+" ";*/ rec_data += Strings.Chr(myData); } this.lb_read.Items.Insert(0, rec_data); if (lb_read.Items.Count > 1000) lb_read.Items.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ProcessByte(byte theByte) { try { int vADC; if (Tab.SelectedIndex == 0) { try { this.Y = 255-theByte; // Received Value if (this.Y >= 500) this.Y = 500; bmp.SetPixel(this.X, this.Y, PlotColor); if (this.Y > 0) vADC = this.Y; picScope.Image = bmp; this.X = this.X + 1; if (this.X >= 500) { bmp.Dispose(); bmp = new Bitmap(800, 800); picScope.Image = bmp; X = 1; } } catch (Exception ex) {
  • 27. PC-BASED DIGITAL OSCILLOSCOPE 27 | P a g e Department Of Electronics and Communication Engineering toolStripStatusLabel1.Text = "Error Occured: " + ex.Message; } } else if (Tab.SelectedIndex == 1) { if (theByte != 0) { buff0 = buff1; buff1 = buff2; buff2 = buff3; buff3 = theByte; } // Current / Capaciance ? if (buff0 == Strings.Asc('C')) { try { if (buff1 == Strings.Asc('U') && buff2 == Strings.Asc('R')) { // Calculate and display Capacitance lblCurrent.Text = "CURRENT: " + Strings.Format(buff3 * 0.01961, "0.00"); Application.DoEvents(); } } catch (Exception ex) { } try { if (buff1 == Strings.Asc('A')) { // Calculate and display capacitance double cap = (buff3 * 256) + buff2; lblCapacitance.Text = "CAPACITANCE: " + Strings.Format(buff3 * 0.01961, "0.00"); Application.DoEvents(); } } catch (Exception ex) { } } else if (buff0 == Strings.Asc('R')) { try { if (buff1 == Strings.Asc('E') && buff2 == Strings.Asc('S')) { // Calculate and display resistance lblResistance.Text = "RESISTANCE: " + Strings.Format(buff3 * 0.01961, "0.00"); Application.DoEvents(); } } catch (Exception ex) { } } } } catch (Exception ex) {
  • 28. PC-BASED DIGITAL OSCILLOSCOPE 28 | P a g e Department Of Electronics and Communication Engineering MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } private void usb_OnDataSend(object sender, EventArgs e) { this.lb_message.Items.Add("Some data was send"); toolStripStatusLabel1.Text = "Some data was send"; } private void Sniffer_Load(object sender, EventArgs e) { try { toolStripStatusLabel1.Text = "Scanning for device"; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void timer1_Tick(object sender, EventArgs e) { btn_ok_Click(sender, e); } private void button5_Click(object sender, EventArgs e) { MessageBox.Show("Under Contruction"); } private void button6_Click(object sender, EventArgs e) { MessageBox.Show("Under Contruction"); } private void button7_Click(object sender, EventArgs e) { MessageBox.Show("Under Contruction"); } private void button8_Click(object sender, EventArgs e) { MessageBox.Show("Under Contruction"); } private void button3_Click(object sender, EventArgs e) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.StartupPath + "resps.exe";
  • 29. PC-BASED DIGITAL OSCILLOSCOPE 29 | P a g e Department Of Electronics and Communication Engineering proc.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } } private void button4_Click(object sender, EventArgs e) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.StartupPath + "resps.exe"; proc.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } } private void button2_Click(object sender, EventArgs e) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.StartupPath + "resps.exe"; proc.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } } private void button1_Click(object sender, EventArgs e) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.StartupPath + "resps.exe"; proc.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } } private void button9_Click(object sender, EventArgs e)
  • 30. PC-BASED DIGITAL OSCILLOSCOPE 30 | P a g e Department Of Electronics and Communication Engineering { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.StartupPath + "resistance.exe"; proc.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } } private void TabPage1_Click(object sender, EventArgs e) { } } }
  • 31. PC-BASED DIGITAL OSCILLOSCOPE 31 | P a g e Department Of Electronics and Communication Engineering FUTURE WORK Clearly there is a lot of additional development work that can be done to improve the design of this low cost PC-based quad channel real-time / storage oscilloscope. This chapter will briefly highlight areas of the design that merits improvement and additional features to make the scope more powerful, reliable, flexible, and commercially marketability. Control Protocol Obviously the first thing that needs to be finished, is the control protocol allowing for the scope program to directly control the sample rate, enable / disable channels, real- time / storage mode, chop or alternate, etc… . Storage Mode Sample a finite number of samples storing them into RAM. Once the memory is full (or the preset number of samples has been reached) the PIC will stop sampling and transfer the data to the PC, when ACK (acknowledgement) is received from the PC the PIC will start sampling again. There is enough information contained in this report to implement this feature, clearly the scope program and PIC software needs modification. TCP / IP Internet Communications Remote monitoring / control of oscilloscope from anywhere in world, for example the machine actually connected to the scope hardware (running in slave mode) relays real- time data through the internet using the TCP / IP internet protocol, the scope program on the other end (master program), receives the data and draws the waveforms as normal. The scope program operating in slave mode has its controls disabled, hence only the master scope program controls the PIC, via the internet and via the slave scope program. Problem the internet (unless using broadband technology, e.g. ASDL, fibre optic) is slow and commonly suffers from net congestion, hence this feature is only useful for slow sampling rates, unless storage mode is used. For example an ECG signal only requires a sample rate of 120 Hz, clearly the internet is capable of transferring this data in real-time without any problems, hence a doctor can remotely diagnosis an ECG signal in real-time.
  • 32. PC-BASED DIGITAL OSCILLOSCOPE 32 | P a g e Department Of Electronics and Communication Engineering SUMMARY AND CONCLUSION FEATURES  Displays on PC various analog waveforms like 1) Sine 2) Triangular 3) rectangular  Computes and display circuit parameters like 1) Capacitance 2) Voltage 3) Resistance 4) Current  Plug and play USB interface to PC Main Advantages of Digital over Analogue Scopes • The ability to observe slow and very slow signals as a solid presentation on the screen.  The PCBO has a very interactive GUI making it more convenient to use than conventional oscilloscopes.  The circuit is extremely cheap and easy to make. Possible Applications For This Pc Based Oscilloscope: -  Monitoring of sound waves, which are difficult to monitor on a traditional oscilloscope due to the low frequencies involved.  Monitoring of an ECG signal, again because this is such a low frequency traditional oscilloscopes would have difficultly monitoring such a signal. ECG data could be logged and emailed directly to the doctor for diagnosis, or perhaps real-time TCP/IP internet communication so that the doctor could remotely monitor the ECG signal in real-time.  Monitoring of serial communications, for example RS485 works on the principal of differential voltages between two cables twisted together; hence the PC based oscilloscope could be used to view serial communications. Two oscilloscope channels would be used, and the PC software will automatically add the two channels together producing a virtual trace (A+B). Note this PC based oscilloscope is also suitable for RS422 communication where there are separate transmit and receive lines (2 sets of differential twisted par cables), hence all four scope channels can be used producing two virtual traces (VC1 = CH1 + CH2, VC2 = CH3 + CH4). This monitoring of serial communication is extremely useful for educational usage (e.g. learning how serial data is transmitted).
  • 33. PC-BASED DIGITAL OSCILLOSCOPE 33 | P a g e Department Of Electronics and Communication Engineering  The PC based oscilloscope is ideal for demonstration purposes, for example using data projector a class of student could be introduced to the oscilloscope, with real waveforms being monitored (signal generator, or even a microphone for sound waves) and displayed on a large projector display.  Because of the low cost of the PC based oscilloscope, it is economical for a school / technical college to have large quantities available for students. Unlike traditional analogue scopes which are expensive and students are forced to share equipment, because it is not economical to purchase enough scopes for every student.
  • 34. PC-BASED DIGITAL OSCILLOSCOPE 34 | P a g e Department Of Electronics and Communication Engineering REFERENCES  http://xoscope.sourceforge.net  http://www.datasheetcatalog.com/datasheets_pdf/A/D/C/0/ADC0804.shtml  http://www.datasheetcatalog.com/datasheets_pdf/7/4/L/S/74LS245.shtml  http://parapin.sourceforge.net/doc/parapin.html  http://tomcat.apache.org/download-55.cgi  http://www.codecomments.com/archive248-2004-4-182225.html  http://www.stardeveloper.com/articles/display.html?article=2003090401&page=1  http://www.frank-buss.de/echoservlet/  http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html  http://www.dgp.toronto.edu/~mjmcguff/learn/java/07-backbuffer/  The Complete Reference JAVA 2 By Herbert Schildt, McGraw Hill Publishers.  http://www.j-nine.com/pubs/applet2servlet/index.htm  http://forum.java.sun.com/thread.jspa?forumID=48&threadID=391594  http://forums.fedoraforum.org/showthread.php?t=47591&highlight=tomcat  http://www.developer.com/java/data/article.php/3417381  http://www.sci.usq.edu.au/staff/leighb/graph/  http://javaboutique.internet.com/educational/  http://tecfa.unige.ch/guides/java/staf2x/ex/jdbc/coffee-break/  http://javaboutique.internet.com/SimplePlot/source.html  http://www.csupomona.edu/~pbsiegel/www/stujav.html  http://servlets.com/jservlet2/examples/ch10/index.html