Step 2: Microcontroller

The microcontroller (a Microchip PIC18F14K50) is the heart of the whole instrument. Above you see a high-level block diagram of its internal structure. As said before, almost all functions are integrated into this single chip, Microchip really managed to pack a ton of features into this little marvel costing just around $3.

Even though there seem to be several ADC input pins the truth is that there really is just a single ADC whose input gets multiplexed onto these pins. That means one can only take one sample on one channel at a time; for two channels the acquisition is done interleaved, i.e. one sample from CH1, then one from CH2, again one from CH1, and so on. The maximum achievable sample rate is just above 50 kSa/sec. (For finer resolutions the scope uses equivalent time sampling, up to 2 MSa/sec equivalent sample rate). The ADC’s analog bandwidth is a few hundred kHz (the data sheet does not specify bandwidth, this number is from my own measurements).

As with the ADC, the comparator inputs can get multiplexed on several different pins – here, CH1 low (1x) and high (10x) gain path and external trigger. The other side gets the trigger threshold, produced by the PWM (pulse width modulation) module. The microcontroller can set up an interrupt that reacts whenever the comparator output changes state (i.e. the input signal crosses the threshold) which allows for very fast, low-latency reaction to trigger events.

The sample logic (actually a piece of code) controls the acquisition process – processing interrupts from the comparator, timer interrupts to sample at regular intervals, transfer of the sampled signal data into the microcontroller’s internal memory (RAM). It can either capture data from the two analog scope channels or from the four digital logic analyzer inputs.

The microcontroller also has a complete USB interface built in which provides data connection to the PC. A program on the PC lets the user control the acquisition settings and displays the data, so it looks and feels like a regular oscilloscope.
The main program running on the microcontroller takes care of communicating with the PC (receiving commands and sending the captured data) and sets up the sample logic, comparator, ADC with the acquisition parameters.

About This Instructable


244 favorites


More by womai: Electronic Heart (Flashing LEDs) - Mother's Day Project DPScope SE - the simplest real oscilloscope/logic analyzer on the planet DPScope - Build Your Own USB/PC-Based Oscilloscope
Add instructable to: