Configurable Logic Cell (CLC) provides programmable logic that operates outside the speed limitations of software execution. The logic cell takes up to 16 input signals and through the use of configurable gates reduces the 16 inputs to four logic lines that drive one of eight selectable single-output logic functions.The Configurable Logic Cell (CLC) can have its functionality pre-programmed or programmed dynamically. This provides greater flexibility and potential in embedded designs.
The CLC Configuration Tool’s purpose is to streamline the setup process of the CLC module by simulating the functionality of the registers in a graphical user interface (GUI). The end result of using the tool will be a generated source code, written in either C or assembly, which can be dropped into an existing MPLABX project file. The created code sample is custom generated, depending on the user inputs and preferences, such as programming language.
The CLC Tool is offered as in two forms:
- Stand-alone GUI application that generates Assembly and C code
- Part of the MPLAB Code Configurator (MCC) tool but only supports C code generation
The video to the right shows a step by step example of using the CLC Configuration Tool. The written step by step guide is below.
CLC GUI Setup Steps
Select the Device
This is where the device, such as the PIC16F1508, will be selected. When a device is selected, the program will configure itself automatically to that specific device, such as data inputs and number of available CLC outputs.
Select the CLC Number
A device can have multiple CLC so you need to select the CLC number you want to setup. Some devices, such as the PIC10F320, will only have one available CLC module in the selected device. The “x” in each CLC register will be replaced by whichever CLC module is used.
Select the Data Inputs
There are four input selection groups. Each group consists of eight selections. For devices with only 8 inputs, all 8 inputs are available in every group. For devices with 16 inputs, only 8 of the 16 are available in each group but are distributed in such a way to minimize precluding some input selection combinations. No input will appear twice in the same group but will appear as an input in other groups.
Once the data inputs are selected, they can be mapped into each of the four gates. The output of each gate will differ according to the logic function selected. To select an input into a gate, simply hover over the desired “X” and click once. The cursor arrow will have changed to the pointer and a line extending the input into the gate will appear. To invert the signal, click again where the “X” was and now a bubble should appear, indicating an inversion. If clicked once more, the bubble and line should disappear and default back to the original unconnected state.
Each of the gate outputs can be inverted. To do so, simply click once on the output of an individual gate for a bubble to appear. The output is now inverted. To undo this, click the bubble again for it to disappear. It is important to note that any gate with no inputs selected will have its output default to the Off state (logic zero). If a constant logic one is desired then invert the default logic zero by clicking the output for the inverting bubble.
Select the Logic Block
There are eight available logic functions selected by the tabs of the CLC tool. The logic blocks cannot be configured other than what is shown. Only one logic function can be used at a time for each CLC module.
The output from the logic block is fed to the last stage of the CLC, the inversion gate. To invert the output, click on the buffer output pin once for a bubble to appear. From here, the output can be routed to other peripherals, an output pin, or back to the CLC input. An interrupt can be enabled upon a rising and/or falling edge from the CLC output. These functions are selected by checking the boxes in the lower right corner of the CLC tool screen.
The CLC Configuration Tool provides a convenient method for saving the design (or loading a previous design). When the design is concluded and ready to be implemented in software, click the File pull-down menu in the top-left corner of the dialog box.
Then click Save ASSY code or Save C code, depending on the desired output language. The code for all configured CLCs of the selected device will be included in the output file. The resultant file will have an .inc extension.
Both pieces of code produce the same affect. The assembly is longer due to the nature of the language. The code can now be easily included as a library file or copy and pasted into an existing program.
Project Comments can also be saved and loaded within the output file. To do so, simply fill out the comments input text area as seen at the bottom of the CLC Configuration Tool screen, before saving.
Loading an existing file:
To load previously saved code from the CLC tool, click file>load code. If imported successfully, the tool will have populated the GUI with the appropriate values corresponding to the registers in the loaded code.
Here is a simple example created with the CLC Configuration Tool that shows the eight registers setup in software to create the CLC setup shown in the picture.
The CLC Configuration Tool is part of the MPLAB Code Configurator.
You can get the CLC Configuration Tool, User Manual and CLC Tips and Tricks Guide directly from the links below.
Note: CLC Tool is now incorporated into the MCC tool. Information on how to install that tool is at the link below: