|
8 | 8 | </picture>
|
9 | 9 | </a>
|
10 | 10 |
|
11 |
| -# Update the title for pic18f56q24-curiosity-nano-explorer-ws2812 here |
| 11 | +# PIC18F54Q24 curiosity nano explorer WS2812 RGB LED |
12 | 12 |
|
13 |
| -<!-- This is where the introduction to the example goes, including mentioning the peripherals used --> |
| 13 | +This example demonstrates the setup of the WS2812B on the Curiosity Nano Explorer Board using the PIC18F56Q24 MCU. The WS2812B is a RGB LED that integrates a control circuit and RGB chip in a package. It allows for easy control of multiple LEDs with a single data line, making it ideal for creating colorful lighting effects and displays. |
| 14 | + |
| 15 | +In this project, we will configure the PIC18F56Q24 MCU to communicate with the WS2812B LEDs and create various lighting patterns. The setup includes initializing the necessary peripherals, configuring the data output pin, and writing the code to send the correct timing signals to control the LEDs. |
14 | 16 |
|
15 | 17 | ## Related Documentation
|
16 | 18 |
|
17 |
| -<!-- Any information about an application note or tech brief can be linked here. Use unbreakable links! |
18 |
| - In addition a link to the device family landing page and relevant peripheral pages as well: |
19 |
| - - [AN3381 - Brushless DC Fan Speed Control Using Temperature Input and Tachometer Feedback](https://microchip.com/00003381/) |
20 |
| - - [PIC18F-Q10 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family) --> |
| 19 | +- [WS2812B Datasheet](https://www.mouser.com/pdfDocs/WS2812B-2020_V10_EN_181106150240761.pdf?srsltid=AfmBOopdvP0PGu8i-pUqTUgdWq0Vi2g59cHWBBg5ldpRW6VLxrdR9cZ1) |
| 20 | +- [PIC18F56Q24 Curiosity Nano User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/PIC18F56Q24-CNANO-UserGuide-DS50003618.pdf) |
| 21 | +- [Curiosity Nano Explorer User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/CNANO-Explorer-UserGuide-DS50003716.pdf) |
21 | 22 |
|
22 |
| -## Software Used |
23 | 23 |
|
24 |
| -<!-- All software used in this example must be listed here. Use unbreakable links! |
25 |
| - - MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide) |
26 |
| - - MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers) |
27 |
| - - MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator) |
28 |
| - - MPLAB® Code Configurator (MCC) Device Libraries PIC10 / PIC12 / PIC16 / PIC18 MCUs [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator) |
29 |
| - - Microchip PIC18F-Q Series Device Support (1.4.109) or newer [(packs.download.microchip.com/)](https://packs.download.microchip.com/) --> |
| 24 | +## Software Used |
30 | 25 |
|
31 | 26 | - MPLAB® X IDE 6.20.0 or newer [(MPLAB® X IDE 6.20)](https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-x-ide)
|
32 |
| -- MPLAB® XC8 3.0.0 or newer compiler [(MPLAB® XC8 3.0)](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers/xc8) |
| 27 | +- MPLAB® XC8 3.00 or newer compiler [(MPLAB® XC8 3.00)](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers/xc8) |
| 28 | +- MPLAB® Code Configurator (MCC) 5.5.1 or newer [(mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator) |
| 29 | + - Microchip PIC18F-Q Series DFP (1.24.433) or newer [(packs.download.microchip.com/)](https://packs.download.microchip.com/) |
33 | 30 |
|
34 | 31 | ## Hardware Used
|
35 | 32 |
|
36 |
| -<!-- All hardware used in this example must be listed here. Use unbreakable links! |
37 |
| - - PIC18F47Q10 Curiosity Nano [(DM182029)](https://www.microchip.com/Developmenttools/ProductDetails/DM182029) |
38 |
| - - Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/Developmenttools/ProductDetails/AC164162) |
39 |
| - - POT Click board™ [(MIKROE-3402)](https://www.mikroe.com/pot-click) --> |
| 33 | +- [PIC18F56Q24 CURIOSITY NANO EVALUATION KIT ](https://www.microchip.com/en-us/development-tool/ev01e86a) |
| 34 | + |
| 35 | +<p align="center"> |
| 36 | + <img src="images/pic18f56q24.png" alt="pic18f56q24"> |
| 37 | + <br> |
| 38 | + <em id="figure-1">Figure 1: PIC18F56Q24 CURIOSITY NANO EVALUATION KIT</em> |
| 39 | +</p> |
| 40 | + |
| 41 | +- [Curiosity Nano Explorer ](https://www.microchip.com/en-us/development-tool/ev58g97a) |
| 42 | + |
| 43 | +<p align="center"> |
| 44 | + <img src="images/curiositynanoexplorer.png" alt="Curiosity Nano Explorer"> |
| 45 | + <br> |
| 46 | + <em id="figure-2">Figure 2: Curiosity Nano Explorer</em> |
| 47 | +</p> |
| 48 | + |
| 49 | +- USB type C cable |
40 | 50 |
|
41 | 51 | ## Setup
|
| 52 | +Block Diagram below shows how to connection and of MCU and WS2812B. |
| 53 | + |
| 54 | +<p align="center"> |
| 55 | + <img src="images/MCU project.png" alt="Block Diagram"> |
| 56 | + <br> |
| 57 | + <em id = "figure-3">Figure 3: Block Diagram</em> |
| 58 | +</p> |
| 59 | +</p> |
| 60 | + |
| 61 | +Follow the steps below to set up and run the example: |
| 62 | + |
| 63 | +1. Connect the PIC18F56Q24 MCU to the Curiosity Nano Explorer board. |
| 64 | +2. Connect the PIC18F56Q24 MCU to your computer using a USB cable. |
| 65 | +3. Make sure the pin WS2812B-RGB is connected to the data line of the WS2812B in the Curiosity Nano Explorer board. |
| 66 | +4. Create a new project in MPLAB® X IDE and open MCC. If first time using MCC, follow this [Getting Started with MCU Projects Using MPLAB® Code Configurator (MCC) Melody - Developer Help](https://developerhelp.microchip.com/xwiki/bin/view/software-tools/frameworks/mcc-melody/getting-started/) |
| 67 | +5. Configure the output pin for the WS2812B LEDs, as shown in [Figure 7](#figure-7). |
| 68 | +6. Write the code to generate the correct timing signals for the WS2812B LEDs. |
| 69 | +7. Compile and program the code into the PIC18F56Q24 MCU. |
| 70 | +8. Observe the lighting patterns and effects created by the LEDs. |
| 71 | + |
| 72 | +### Pin Setup |
| 73 | +The [User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/CNANO-Explorer-UserGuide-DS50003716.pdf) for the Curiosity Explorer Nano board provides the pin mappings. |
| 74 | + |
| 75 | +<p align="center"> |
| 76 | + <img src="images/ExplorerWS2812.png" alt="ExplorerWS2812"> |
| 77 | + <br> |
| 78 | + <em id = "figure-4">Figure 4: Explorer WS2812B Pin Mappings</em> |
| 79 | +</p> |
| 80 | +</p> |
| 81 | + |
| 82 | +As shown in [Figure 4](#figure-4) above, pin IO 27 of the Curiosity Explorer Nano board is connected to the data line of the WS2812B LEDs. |
| 83 | + |
| 84 | +<p align="center"> |
| 85 | + <img src="images/PIC18F56Q24_CuriosityNano.png" alt="CNANO_PINS"> |
| 86 | + <br> |
| 87 | + <em id="figure-5">Figure 5: PIC18F56Q26 Pin Mappings</em> |
| 88 | +</p> |
| 89 | +</p> |
| 90 | + |
| 91 | +Pin mapping for PIC18F56Q24 can be find in [PIC18F56Q24 User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/PIC18F56Q24-CNANO-UserGuide-DS50003618.pdf#page=6) |
| 92 | + |
| 93 | +Based on [Figure 5](#figure-5) and [Figure 6](#figure-6), the pin IO 27 of the Curiosity Explorer Nano board is connected to the data line of the WS2812B LEDs. Ensure that the jumper is connected to link the pins **WS2812B-RGB** on the Curiosity Explorer Nano Board. |
| 94 | + |
| 95 | +The pin in this example project is connected to pin RE0 of the PIC18F56Q24 MCU. This pin is required to be configured as an output pin in MCC. |
| 96 | + |
| 97 | +<p align="center"> |
| 98 | + <img src="images/CuriosityNanoExplorerPinouts.png" alt="CNANO_PINS"> |
| 99 | + <br> |
| 100 | + <em id="figure-6">Figure 6: Curiosity Nano Explorer Pinouts</em> |
| 101 | +</p> |
| 102 | +</p> |
| 103 | + |
| 104 | +Pinout for CNANO Socket can be find in the [Curiosity Nano Explorer User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/CNANO-Explorer-UserGuide-DS50003716.pdf#page=9) |
| 105 | + |
| 106 | +In MCC, select RE0 as output pin as shown in the [Figure 7](#figure-7) below. RE0 is renamed to be RGB in the Pin configuration window as shown in [Figure 8](#figure-8) below. |
| 107 | + |
| 108 | +<p align="center"> |
| 109 | + <img src="images/PinGrid_View.png" alt="PinGridView"> |
| 110 | + <br> |
| 111 | + <em id="figure-7">Figure 7: Pin Grid View for LED Output</em> |
| 112 | +</p> |
| 113 | +</p> |
| 114 | + |
| 115 | +<p align="center"> |
| 116 | + <img src="images/Pin Name.png" alt="Pin Name"> |
| 117 | + <br> |
| 118 | + <em id="figure-8">Figure 8: Pin Name for LED Output</em> |
| 119 | +</p> |
| 120 | +</p> |
| 121 | + |
| 122 | +MCC setup remain default, only adding 1 output pin for this example, the next step is to write the code to send the timing signals required by the WS2812B LEDs. |
42 | 123 |
|
43 |
| -<!-- Explain how to connect hardware and set up software. Depending on complexity, step-by-step instructions and/or tables and/or images can be used --> |
| 124 | +### Code setup |
| 125 | +For complete application code and comprehensive description of the implementation, please refer to [main.c](\RGB_WS2812B.X\main.c) for the complete code. |
44 | 126 |
|
45 | 127 | ## Operation
|
| 128 | +After programmed the device, the lighting patterns and effects created by the WS2812B LEDs should be obsereved. If not, ensure that: |
46 | 129 |
|
47 |
| -<!-- Explain how to operate the example. Depending on complexity, step-by-step instructions and/or tables and/or images can be used --> |
| 130 | +The output pin is correctly configured and connected to the data line of the WS2812B LEDs. |
| 131 | +The code is correctly generating the timing signals required by the WS2812B LEDs. |
48 | 132 |
|
49 | 133 | ## Summary
|
| 134 | +This document provides a guide for setting up and running an example project that demonstrates the control of WS2812B RGB LEDs using the PIC18F56Q24 MCU on the Curiosity Nano Explorer Board. It includes steps for hardware setup, software configuration, and code implementation. The document also provides links to related documentation, lists the required software and hardware, and describes the features and prerequisites for the project. Detailed instructions are given for configuring the output pin and writing the code to control the LEDs. Finally, it offers guidelines for verifying the correct operation of the project and troubleshooting any issues. |
50 | 135 |
|
51 |
| -<!-- Summarize what the example has shown --> |
|
0 commit comments