Skip to content

Code example for "Getting Started with CLC on PIC18" Technical Brief : Using the CLC to create a LED Dimming Effect - MCC Generated Code

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f47q10-cnano-clc-latch-mcc

Repository files navigation

MCHP

PIC18F47Q10: Getting started with the CLC on PIC18 -> Using the CLC to Create an LED Dimming Effect -> MCC Generated code

Objective:

The PIC18F47Q10 features 8 Configurable Logic Cell (CLC) peripherals that cen be used to implemenmt various logic functions. This example shows an initialization of the CLC in the SR Latch mode that enables the implementation of an automatic fixed frequency with variable duty-cycle PWM signal. The function is called automatic as it does not require code or core supervision to work, the hardware is set at start-up and can be reconfigured during run-time.

Related Documentation

Existing application notes or tech briefs that are related to the subject:

Software Used

Hardware Used

Setup

The following configurations must be made for this project:

  • Timer 2 frequency = 24.41 Hz (4.096 ms period)
  • Timer 4 frequency = 24.51 Hz (4.08 ms period)

CLC Configuration:

  • CLC1 is set up as SR Latch


OR CLC Config

I/O configurations:

Pin Configuration
RA2 Digital Output


I/O pin mapping

This setup will create an internal connection as depicted:


Internal Depiction

Operation

Run the code generated by MCC, the following signals are to be seen on the oscilloscope:

In the figure below it is depicted the CLC1 output implementing the fixed frequency with variable duty-cycle function:

  • Signal 2 (Green) is CLC1 output


Figure A

Summary

This project showcases how the Core Independent Peripherals (CIPs) on the new PIC18-Q10 can be used to create an automatic fixed frequency with variable duty-cycle PWM signal. This example shows an initialization of the CLC in the SR Latch mode that enables this implementation. The function is called automatic as it does not require code or core supervision to work, the hardware is set at start-up and can be reconfigured during run-time.

About

Code example for "Getting Started with CLC on PIC18" Technical Brief : Using the CLC to create a LED Dimming Effect - MCC Generated Code

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published