Skip to content

Samsc45/PIC18-Logic-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ Logic Analyzer

Featuring PIC18F45K50 & Python Visualization

πŸ“ Project Overview

A Logic Analyzer is a diagnostic tool used to capture and display digital signals from electronic circuits. Unlike an oscilloscope, it focuses strictly on logic statesβ€”HIGH (1) or LOW (0)β€”over time.

πŸ–₯️ Interface & Examples

Logic Analyzer Interface

Signal Capture Examples:

Example 1 (PWM/UART) Analysis
Example 2 (Timing) Detailed View

πŸ› οΈ Hardware: PIC18F45K50 Microcontroller

This project utilizes the PIC18F45K50, specifically chosen for its integrated USB 2.0 module.

PIC18F45K50 Chip

Circuit Design

Proteus Schematic Breadboard Wiring

  • Active Clock Tuning: USB communication requires an exact 48 MHz clock. We utilized the internal oscillator with PLL and the Active Tuning feature to synchronize the clock with the USB host without an external crystal.
  • Stability: Ensures reliable communication while reducing the external component count.

πŸ“ Sampling Theory

Nyquist-Shannon Theorem

To reconstruct a signal without aliasing, the sampling rate must be at least twice the maximum frequency of the analyzed signal.

Sampling Theory

Capture Implementation (Timer2 & RB1)

  • Sampling Rate: Configured via Timer2 hardware interrupts every 10 Β΅s, achieving a stable 100 kHz rate.
  • Buffer Capacity: Captures 900 consecutive samples through PIN B1 (RB1).

⚑ Hardware Programming (PICKit 3)

Programming is performed using the ICSP standard.

PICKit 3 Connection Pinout Diagram

Software: PICkitminus

To flash the .hex file, PICkitminus is highly recommended due to its stability on modern operating systems.

PICkitminus Interface

PICkitminus GUI Interface


πŸ’» Software Environment

Developed in Python using Visual Studio Code.

Installation & Dependencies

Install the required libraries using the following command:

pip install pyserial matplotlib 

πŸš€ Future Improvements & Roadmap

This project is an evolving platform. Future updates will focus on expanding hardware capabilities and software analysis tools:

  • Dual-Channel Support: Modify firmware to sample two digital pins (e.g., RB1 and RB2) simultaneously.
  • Protocol Decoders: Add automated decoding for UART, I2C, and SPI directly on the Matplotlib interface.

About

A digital logic analyzer based on PIC18F45K50 and Python using USB CDC communication.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors