Skip to content

Commit 30cf8c6

Browse files
committed
MPAE-12623: MCC port classic to melody
Merge in EBE/avr128db48-constant-current-driver-using-opamp-mplab-mcc from feature/MPAE-12623-melody-port to develop
1 parent cd326a5 commit 30cf8c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2254
-11793
lines changed

.main-meta/main.json

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
"content": {
55
"metaDataVersion": "1.1.0",
66
"name": "com.microchip.mcu8.mplabx.project.avr128db48-constant-current-driver-using-opamp-mplab-mcc",
7-
"version": "1.0.0",
7+
"version": "2.0.0",
88
"displayName": "Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral",
99
"projectName": "avr128db48-constant-current-driver-using-opamp-mplab-mcc",
10-
"shortDescription": "This MCC based MPLAB X IDE example shows how to use the Analog Signal Conditioning (OPAMP) peripheral to implement a constant-current driver using just one external resistor. The constant current amperage setting can be adjusted using firmware control.",
10+
"shortDescription": "This MPLAB X Melody example shows how to use the Analog Signal Conditioning (OPAMP) peripheral to implement a constant-current driver using just one external resistor. The constant current amperage setting can be adjusted using firmware control.",
1111
"ide": {
1212
"name": "MPLAB X",
13-
"semverRange": ">=5.45.0"
13+
"semverRange": ">=5.50.0"
1414
},
1515
"compiler": [
16-
{
17-
"name": "XC8",
18-
"semverRange": "^2.31.0"
19-
}
20-
],
16+
{
17+
"name": "XC8",
18+
"semverRange": "^2.32.0"
19+
}
20+
],
2121
"dfp": {
2222
"name": "AVR-Dx_DFP",
23-
"semverRange": "^1.6.88"
23+
"semverRange": "^1.7.98"
2424
},
2525
"configurator": {
2626
"name": "MCC",
27-
"semverRange": ">=4.0.2"
27+
"semverRange": ">=4.1.0"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",
@@ -36,44 +36,46 @@
3636
"versionRange": "*"
3737
}
3838
},
39-
"author": "Henrik Nyholm",
40-
"subcategories": ["MCC",
41-
[
42-
"Peripherals", "OPAMP"
43-
],
39+
"author": "Martin Thomaz",
40+
"subcategories": [
4441
[
45-
"Peripherals", "DAC"
46-
],
42+
"Peripherals",
43+
"OPAMP"
44+
],
4745
[
48-
"Development Kit", "AVR128DB48 Curiosity Nano"
49-
]
46+
"Peripherals",
47+
"DAC"
48+
]
5049
],
5150
"peripherals": [
52-
"OPAMP", "DAC"
51+
"OPAMP",
52+
"DAC"
5353
],
5454
"keywords": [
55-
"Analog Signal Conditioning",
56-
"Operational Amplifier",
55+
"Analog Signal Conditioning",
56+
"Operational Amplifier",
5757
"Op Amp",
58-
"Resistor Ladder",
59-
"Constant Current",
60-
"Current Driver",
61-
"D/A Converters",
62-
"Low BOM",
63-
"CIP",
58+
"Resistor Ladder",
59+
"Constant Current",
60+
"Current Driver",
61+
"D/A Converter",
62+
"Low BOM",
63+
"CIP",
6464
"constant-current-driver-using-opamp",
65-
"Current Source"
65+
"Current Source",
66+
"Melody",
67+
"Curiosity Nano"
6668
],
67-
"additionalData": {
68-
"longDescription": {
69-
"metaDataVersion": "1.0.0",
70-
"category": "com.microchip.portal.fileRef",
71-
"content": {
72-
"metaDataVersion": "1.0.0",
73-
"fileName": "./README.md",
74-
"mimeType": "text/markdown"
75-
}
76-
}
77-
}
78-
}
69+
"additionalData": {
70+
"longDescription": {
71+
"metaDataVersion": "1.0.0",
72+
"category": "com.microchip.portal.fileRef",
73+
"content": {
74+
"metaDataVersion": "1.0.0",
75+
"fileName": "./README.md",
76+
"mimeType": "text/markdown"
77+
}
78+
}
79+
}
80+
}
7981
}

README.md

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2-
<a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300"/></a>
1+
<!-- Please do not change this logo with link -->
2+
[![MCHP](images/microchip.png)](https://www.microchip.com)
33

44
# Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral
55
<p align="left">
@@ -16,9 +16,10 @@ A new feature introduced in the AVR® DB MCU is the Analog Signal Conditioning (
1616

1717
## Software Used
1818

19-
* [MPLAB® X](https://www.microchip.com/mplab/mplab-x-ide) v5.45 or later
20-
* [MPLAB® XC8 Compiler](https://www.microchip.com/mplab/compilers) v2.31 or later
21-
* MPLABX AVR-Dx_DFP version 1.6.88 or later
19+
* [MPLAB® X](https://www.microchip.com/mplab/mplab-x-ide) v5.50 or later
20+
* [MPLAB® Code Configurator (MCC)](https://www.microchip.com/mplab/mplab-code-configurator) 4.1.0 or newer
21+
* [MPLAB® XC8 Compiler](https://www.microchip.com/mplab/compilers) v2.32 or later
22+
* MPLABX AVR-Dx_DFP version 1.7.98 or later
2223
* For the START based Microchip Studio version of this project, please go to [this repository](https://github.com/microchip-pic-avr-examples/avr128db48-constant-current-driver-using-opamp-studio-start)
2324

2425
## Hardware Used
@@ -27,18 +28,53 @@ A new feature introduced in the AVR® DB MCU is the Analog Signal Conditioning (
2728
* One resistor (value dependent on desired current)
2829
* Load (LED, etc)
2930

30-
## Demo Configuration
31+
## Peripherals Configuration using MCC
32+
33+
### Added Peripherals
34+
35+
* Add the **OPAMP** Driver under **Device Resources** tab
36+
37+
![OPAMP_driver](images/MCC_Melody_adding_OPAMP_driver.png)
38+
39+
* The *Builder* tab shows the system, with the added **OPAMP** block
40+
41+
![Builder](images/MCC_Melody_builder.png)
42+
43+
* Click on the **OPAMP** block, to enable the OPAMP driver configuration **Easy View** and configure as shown below
44+
45+
![Builder](images/MCC_Melody_OPAMP_Configuration.png)
46+
47+
* Click on **Generate** in the **Resource Management** tab to generate the source code
48+
49+
![Builder](images/MCC_Melody_generate.png)
50+
51+
## Setup
3152
* Connect the load, such as an LED, between PD2 (OP0OUT) and PD3 (OP0INN) as shown in the schematic above
53+
3254
* Connect a resistor, R3, from PD3 (OP0INN) to GND. The value of R3 determines the amperage of the constant current. For instance, using R3 = 205Ω will yield a current of 1mA with this example implementation. See the [application note](https://microchip.com/DS00003632) for more information on how to configure R3 to produce a constant current with a specific amperage.
33-
* To change the constant current level value in firmware with MCC, click on the *MCC* button in MPLAB X and click on the *OPAMP* peripheral under *Project Resources*. In the *OPAMP* tab, under *Easy Seup* find and click on the *OP0* tab. Use the drop down menu on the *MUXWIP: Multiplexer for Wiper Multiplexer* setting to change the amperage of the constant current according to the formula described in the [application note](https://microchip.com/DS00003632).
3455

35-
## Running the Demo in MPLAB X
56+
* To change the constant current level value in firmware with MCC, click on the **MCC** button in MPLAB X and click on the **OPAMP** peripheral under **Project Resources**. In the **OPAMP** tab, under **Easy Setup** find and click on the **OP0** tab. Use the drop down menu on the **MUXWIP: Multiplexer for Wiper Multiplexer** setting to change the amperage of the constant current according to the table below
57+
58+
![MUXWIP Selection of Current Value](images/MCC_OPAMP_MUXWIP_gain.png)
59+
60+
## Operation
3661
* Connect the AVR128DB48 Curiosity Nano to a computer using a USB cable
37-
* Download the *.zip file or clone the example to get the source code
38-
* Open `avr128db48-constant-current-driver-using-opamp-mplab-mcc.X` in MPLAB X
39-
* Press the make and program button to program the device
40-
* If no tool has been chosen, a window will open, select the AVR128DB48 Curiosity Nano. The tool can also be choosen in the project settings.
4162

42-
## Conclusion
63+
* Download the "*.zip" file or clone this repository to get the source code
64+
65+
* Open the `avr128db48-constant-current-driver-using-opamp-mplab-mcc.X` project in MPLAB X
66+
67+
* Click the **clean and build** button to compile the code
68+
![Builder](images/clean_and_build.png)
69+
70+
71+
* Click the **make and program** button to program the device
72+
![Builder](images/make_and_prog.png)
73+
74+
* If no tool has been chosen, a window will open, select the AVR128DB48 Curiosity Nano evaluation kit. The tool can also be chosen in the project settings.
75+
76+
## Summary
4377
After going through this example you should have a better understanding of how to set up the OPAMP peripheral as a constant current driver with a specific amperage for a load.
4478

79+
Also, If more precise control of the current value is required, the MCU’s digital-to-analog converter (DAC) can be internally connected to the non-inverting (+) input of the op amp, see the [application note](https://microchip.com/DS00003632) for more information
80+

0 commit comments

Comments
 (0)