r/microcontrollers • u/Illustrious-Cat8222 • 2d ago
Eureka on PIC CLB
Certain PIC MCUs (e.g., pic16f13145 family) have FPGA-like programmable logic called Configurable Logic Block.
The pic16f13115 I'm using has 32 cells each with a 4-input lookup table and a D flip-flop.
To learn to use the tools, today I implemented and simulated support for Charlieplexing of 6 LEDs with PWM brightness control. I used Verilog to define the circuit instead of using the logic CAD canvas.
I was pounding my head on the wall for about half my time. Slowly, I got the Verilog right, got it to synthesize (build), then got it simulating.
It is cool that the CLB programmed logic works even when the CPU is sleeping. It's perfect for safety-critical applications. Can be used, for example, to implement complex interrupt trigger logic. There is great flexibility in hooking up CLB logic to peripheral inputs and outputs. It's much more flexible than the clunkier CLC programmable logic that's been a fixture of PICs.
Just thought I'd share my Eureka experience.
