You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"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.",
# Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral
5
5
<palign="left">
@@ -16,9 +16,10 @@ A new feature introduced in the AVR® DB MCU is the Analog Signal Conditioning (
16
16
17
17
## Software Used
18
18
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
22
23
* 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)
23
24
24
25
## Hardware Used
@@ -27,18 +28,53 @@ A new feature introduced in the AVR® DB MCU is the Analog Signal Conditioning (
27
28
* One resistor (value dependent on desired current)
28
29
* Load (LED, etc)
29
30
30
-
## Demo Configuration
31
+
## Peripherals Configuration using MCC
32
+
33
+
### Added Peripherals
34
+
35
+
* Add the **OPAMP** Driver under **Device Resources** tab
* Click on **Generate** in the **Resource Management** tab to generate the source code
48
+
49
+

50
+
51
+
## Setup
31
52
* Connect the load, such as an LED, between PD2 (OP0OUT) and PD3 (OP0INN) as shown in the schematic above
53
+
32
54
* 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).
34
55
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
+

59
+
60
+
## Operation
36
61
* 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.
41
62
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
+

69
+
70
+
71
+
* Click the **make and program** button to program the device
72
+

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
43
77
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.
44
78
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
0 commit comments