Skip to content

Commit ddc7715

Browse files
committed
MPAE-8667 Initial example code and readme added
1 parent 2859ffd commit ddc7715

Some content is hidden

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

53 files changed

+7898
-39
lines changed

.main-meta/main.json

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,66 @@
44
"content": {
55
"metaDataVersion": "1.1.0",
66
"name": "com.microchip.mcu8.studio.project.avr128db48-constant-current-driver-using-opamp-studio-start",
7-
"version": "",
8-
"displayName": "",
7+
"version": "1.0.0",
8+
"displayName": "Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral",
99
"projectName": "avr128db48-constant-current-driver-using-opamp-studio-start",
10-
"shortDescription": "",
10+
"shortDescription": "This START based Microchip Studio example shows how to use the Analog Signal Conditioning (OPAMP) peripheral to implement a constant-current driver using one external resistor. The constant current amperage setting can be adjusted using firmware control.",
1111
"ide": {
1212
"name": "STUDIO",
13-
"semverRange": ""
13+
"semverRange": ">=7.0.2542"
1414
},
1515
"compiler": [
1616
{
17-
"name": "",
18-
"semverRange": ""
17+
"name": "AVR GCC",
18+
"semverRange": "^5.4.0"
1919
}
2020
],
2121
"dfp": {
22-
"name": "",
23-
"semverRange": ""
22+
"name": "AVR-Dx_DFP",
23+
"semverRange": "^1.6.76"
2424
},
2525
"configurator": {
26-
"name": "",
27-
"semverRange": ""
26+
"name": "START",
27+
"semverRange": ">=1.8.491"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",
3131
"category": "com.microchip.portal.contentRef",
3232
"content": {
3333
"metaDataVersion": "1.0.0",
3434
"category": "com.microchip.device",
35-
"name": "",
35+
"name": "AVR128DB48",
3636
"versionRange": "*"
3737
}
3838
},
39-
"author": "",
39+
"author": "Henrik Nyholm",
4040
"subcategories": [
41+
"START",
42+
[
43+
"Peripherals", "OPAMP"
44+
],
45+
[
46+
"Peripherals", "DAC"
47+
],
48+
[
49+
"Development Kit", "AVR128DB48 Curiosity Nano"
50+
]
4151
],
4252
"peripherals": [
53+
"OPAMP", "DAC"
4354
],
4455
"keywords": [
56+
"Analog Signal Conditioning",
57+
"Operational Amplifier",
58+
"Op Amp",
59+
"Resistor Ladder",
60+
"Constant Current",
61+
"Current Driver",
62+
"D/A Converters",
63+
"Low BOM",
64+
"CIP",
65+
"constant-current-driver-using-opamp",
66+
"Current Source"
4567
],
4668
"additionalData": {
4769
"longDescription": {

README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
<!-- Please do not change this logo with link -->
2-
[![MCHP](images/microchip.png)](https://www.microchip.com)
31

4-
# Update the title for avr128db48-constant-current-driver-using-opamp-studio-start here
2+
<a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300"/></a>
53

6-
<!-- This is where the introduction to the example goes, including mentioning the peripherals used -->
4+
# Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral
5+
<p align="left">
6+
<img width=800px height=auto src="images/setup.png">
7+
</p>
8+
9+
A new feature introduced in the AVR® DB MCU is the Analog Signal Conditioning (OPAMP) peripheral. In this example, the OPAMP is used as a constant-current driver using a single external resistor. It can be used to drive a load such as LEDs, with constant current and not constant voltage. The OPAMP peripheral also provides the ability to adjust the current setting under firmware control. The configuration for this example can be seen in the figure above. For more information about setup and code, see the [application note](https://microchip.com/DS00003632).
710

811
## Related Documentation
912

10-
<!-- Any information about an application note or tech brief can be linked here. Use unbreakable links!
11-
In addition a link to the device family landing page and relevant peripheral pages as well:
12-
- [AN3381 - Brushless DC Fan Speed Control Using Temperature Input and Tachometer Feedback](https://microchip.com/00003381/)
13-
- [PIC18F-Q10 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family) -->
13+
* [AN3632 - Constant-Current Driver Using the Analog Signal Conditioning (OPAMP) Peripheral](https://microchip.com/DS00003632)
14+
* [AVR128DB48 Curiosity Nano User Guide](https://www.microchip.com/DS50003037)
15+
* [AVR128DB48 Device Page](https://www.microchip.com/wwwproducts/en/AVR128DB48)
1416

1517
## Software Used
1618

17-
<!-- All software used in this example must be listed here. Use unbreakable links!
18-
- MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide)
19-
- MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers)
20-
- MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
21-
- 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)
22-
- Microchip PIC18F-Q Series Device Support (1.4.109) or newer [(packs.download.microchip.com/)](https://packs.download.microchip.com/) -->
23-
19+
* [Microchip Studio](https://www.microchip.com/mplab/avr-support/atmel-studio-7) 7.0.4002 or later
20+
* Microchip Studio AVR-Dx_DFP version 1.6.76 or later
21+
* For the MCC based MPLAB X version of this project, please go to [this repository](https://github.com/microchip-pic-avr-examples/avr128db48-constant-current-driver-using-opamp-mplab-mcc)
22+
2423
## Hardware Used
2524

26-
<!-- All hardware used in this example must be listed here. Use unbreakable links!
27-
- PIC18F47Q10 Curiosity Nano [(DM182029)](https://www.microchip.com/Developmenttools/ProductDetails/DM182029)
28-
- Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/Developmenttools/ProductDetails/AC164162)
29-
- POT Click board™ [(MIKROE-3402)](https://www.mikroe.com/pot-click) -->
30-
31-
## Setup
32-
33-
<!-- 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 -->
25+
* [AVR128DB48 Curiosity Nano](https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/EV35L43A)
26+
* One resistor (value dependent on desired current)
27+
* Load (LED, etc)
3428

35-
## Operation
29+
## Demo Configuration
30+
* Connect the load, such as an LED, between PD2 (OP0OUT) and PD3 (OP0INN) as shown in the schematic above
31+
* 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.
32+
* To change the constant current level value in firmware inside Microchip Studio, go to *Project* and select *Re-Configure Atmel Start Project* to open START inside the IDE. Select the *OPERATIONAL_AMPLIFIER* componenet and scroll down to the *OPAMP0 SETTINGS*. 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).
3633

37-
<!-- Explain how to operate the example. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
34+
## Running the Demo in Microchip Studio
35+
* Connect the AVR128DB48 Curiosity Nano to a computer using a USB cable
36+
* Download the *.zip file or clone the example to get the source code
37+
* Open the *.atsln file with Microchip Studio
38+
* Press *Start Without Debugging* (CTRL+ALT+F5) to build and program the device in order to run the application
3839

39-
## Summary
40+
## Conclusion
41+
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.
4042

41-
<!-- Summarize what the example has shown -->
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+

2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Atmel Studio Solution File, Format Version 11.00
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "avr128db48-constant-current-driver-using-opamp-studio-start", "avr128db48-constant-current-driver-using-opamp-studio-start\avr128db48-constant-current-driver-using-opamp-studio-start.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|AVR = Debug|AVR
11+
Release|AVR = Release|AVR
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
15+
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
16+
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
17+
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<environment>
2+
<configurations>
3+
<configuration environment="Atmel Studio" name="All" version="7.0.0">
4+
<linker-config>
5+
<option id="avrgcc_linker_miscellaneous_LinkerFlags" name="avrgcc-linker-miscellaneous-LinkerFlags">
6+
<value>
7+
</value>
8+
</option>
9+
</linker-config>
10+
<linker-script-config />
11+
<compiler-config>
12+
<option id="avrgcc_compiler_miscellaneous_OtherFlags" name="avrgcc-compiler-miscellaneous-OtherFlags">
13+
<value>-std=gnu99</value>
14+
</option>
15+
</compiler-config>
16+
</configuration>
17+
<configuration environment="Microchip Studio xc8" name="Release" version="7.0.0">
18+
<linker-config>
19+
<option id="xc8_linker_miscellaneous_LinkerFlags" name="xc8-linker-miscellaneous-LinkerFlags">
20+
<value>
21+
</value>
22+
</option>
23+
</linker-config>
24+
<linker-script-config />
25+
<compiler-config>
26+
<option id="xc8_compiler_miscellaneous_OtherFlags" name="xc8-compiler-miscellaneous-OtherFlags">
27+
<value>-std=gnu99</value>
28+
</option>
29+
</compiler-config>
30+
</configuration>
31+
<configuration environment="Microchip Studio xc8" name="Debug" version="7.0.0">
32+
<linker-config>
33+
<option id="xc8_linker_miscellaneous_LinkerFlags" name="xc8-linker-miscellaneous-LinkerFlags">
34+
<value>
35+
</value>
36+
</option>
37+
</linker-config>
38+
<linker-script-config />
39+
<compiler-config>
40+
<option id="xc8_compiler_miscellaneous_OtherFlags" name="xc8-compiler-miscellaneous-OtherFlags">
41+
<value>-std=gnu99</value>
42+
</option>
43+
</compiler-config>
44+
</configuration>
45+
<configuration environment="Microchip Studio gcc" name="Release" version="7.0.0">
46+
<linker-config>
47+
<option id="avrgcc_linker_miscellaneous_LinkerFlags" name="avrgcc-linker-miscellaneous-LinkerFlags">
48+
<value>
49+
</value>
50+
</option>
51+
</linker-config>
52+
<linker-script-config />
53+
<compiler-config>
54+
<option id="avrgcc_compiler_miscellaneous_OtherFlags" name="avrgcc-compiler-miscellaneous-OtherFlags">
55+
<value>-std=gnu99</value>
56+
</option>
57+
</compiler-config>
58+
</configuration>
59+
<configuration environment="Microchip Studio gcc" name="Debug" version="7.0.0">
60+
<linker-config>
61+
<option id="avrgcc_linker_miscellaneous_LinkerFlags" name="avrgcc-linker-miscellaneous-LinkerFlags">
62+
<value>
63+
</value>
64+
</option>
65+
</linker-config>
66+
<linker-script-config />
67+
<compiler-config>
68+
<option id="avrgcc_compiler_miscellaneous_OtherFlags" name="avrgcc-compiler-miscellaneous-OtherFlags">
69+
<value>-std=gnu99</value>
70+
</option>
71+
</compiler-config>
72+
</configuration>
73+
</configurations>
74+
<device-packs>
75+
<device-pack device="AVR128DB48" name="AVR-Dx_DFP" vendor="Atmel" version="1.6.76" />
76+
</device-packs>
77+
</environment>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<package xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xs:noNamespaceSchemaLocation="PACK.xsd">
2+
<vendor>Atmel</vendor>
3+
<name>My Project</name>
4+
<description>Project generated by Atmel Start</description>
5+
<url>http://start.atmel.com/</url>
6+
<releases>
7+
<release version="1.0.1">Initial version</release>
8+
</releases>
9+
<taxonomy>
10+
<description Cclass="AtmelStart" generator="AtmelStart">Configuration Files generated by Atmel Start</description>
11+
</taxonomy>
12+
<generators>
13+
<generator id="AtmelStart">
14+
<description>Atmel Start</description>
15+
<select Dname="AVR128DB48" Dvendor="Atmel:3"/>
16+
<command>http://start.atmel.com/</command>
17+
<files>
18+
<file category="generator" name="atmel_start_config.atstart"/>
19+
<file attr="template" category="other" name="AtmelStart.env_conf" select="Environment configuration"/>
20+
</files>
21+
</generator>
22+
</generators>
23+
<conditions>
24+
<condition id="AVR Device Startup">
25+
<description>Dependency on Device Startup components</description>
26+
<require Cclass="Device" Cgroup="Startup" Cversion="1.6.0"/>
27+
</condition>
28+
<condition id="ARMCC, GCC, IAR, XC8">
29+
<require Dname="AVR128DB48"/>
30+
<accept Tcompiler="ARMCC"/>
31+
<accept Tcompiler="GCC"/>
32+
<accept Tcompiler="IAR"/>
33+
<accept Tcompiler="XC8"/>
34+
</condition>
35+
</conditions>
36+
<components generator="AtmelStart">
37+
<component Cclass="AtmelStart" Cgroup="Framework" Cversion="1.0.0" condition="AVR Device Startup">
38+
<description>Atmel Start Framework</description>
39+
<RTE_Components_h>#define ATMEL_START</RTE_Components_h>
40+
<files>
41+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/generator/DoxygenLayout.xml"/>
42+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/generator/doxyfile.doxygen"/>
43+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/mainpage.dox"/>
44+
<file category="doc" condition="ARMCC, GCC, IAR, XC8" name="modules/bod/doc/bod.rst"/>
45+
<file category="doc" condition="ARMCC, GCC, IAR, XC8" name="modules/clkctrl/doc/clkctrl.rst"/>
46+
<file category="doc" condition="ARMCC, GCC, IAR, XC8" name="modules/cpuint/doc/cpuint.rst"/>
47+
<file category="doc" condition="ARMCC, GCC, IAR, XC8" name="modules/opamp/doc/opamp.rst"/>
48+
<file category="doc" condition="ARMCC, GCC, IAR, XC8" name="modules/slpctrl/doc/slpctrl.rst"/>
49+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="main.c"/>
50+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/driver_init.c"/>
51+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/driver_init.h"/>
52+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/atmel_start_pins.h"/>
53+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="driver_isr.c"/>
54+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/mainpage.dox"/>
55+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/generator/doxyfile.doxygen"/>
56+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/generator/DoxygenLayout.xml"/>
57+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/opamp.dox"/>
58+
<file category="other" condition="ARMCC, GCC, IAR, XC8" name="doxygen/system.dox"/>
59+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/bod.h"/>
60+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/ccp.h"/>
61+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/clkctrl.h"/>
62+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/cpuint.h"/>
63+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/opamp_basic.h"/>
64+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/port.h"/>
65+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/protected_io.h"/>
66+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/rstctrl.h"/>
67+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/slpctrl.h"/>
68+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="include/system.h"/>
69+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/bod.c"/>
70+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/clkctrl.c"/>
71+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/cpuint.c"/>
72+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/opamp_basic.c"/>
73+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/protected_io.S"/>
74+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="src/slpctrl.c"/>
75+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/assembler.h"/>
76+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/assembler/gas.h"/>
77+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/assembler/iar.h"/>
78+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/atomic.h"/>
79+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/compiler.h"/>
80+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/interrupt_avr8.h"/>
81+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/utils.h"/>
82+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="utils/utils_assert.h"/>
83+
<file category="header" condition="ARMCC, GCC, IAR, XC8" name="atmel_start.h"/>
84+
<file category="source" condition="ARMCC, GCC, IAR, XC8" name="atmel_start.c"/>
85+
<file attr="config" category="header" condition="ARMCC, GCC, IAR, XC8" name="config/clock_config.h"/>
86+
<file category="include" condition="ARMCC, GCC, IAR, XC8" name="config"/>
87+
<file category="include" condition="ARMCC, GCC, IAR, XC8" name="include"/>
88+
<file category="include" condition="ARMCC, GCC, IAR, XC8" name="utils"/>
89+
<file category="include" condition="ARMCC, GCC, IAR, XC8" name="utils/assembler"/>
90+
<file category="include" condition="ARMCC, GCC, IAR, XC8" name=""/>
91+
</files>
92+
</component>
93+
</components>
94+
</package>

0 commit comments

Comments
 (0)