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
Copy file name to clipboardExpand all lines: README.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
# Blink with Timer Overflow
5
5
6
-
This code example shows how to use single slope Pulse-Width Modulation (PWM) in the Timer/Counter A (TCA) on the AVR® DB Family of microcontrollers to generate overflow interrupts that toggle a LED. The time between each overflow interrupt is determined by the TCA clock prescaler selection and the value loaded into the period register. Then the overflow interrupt is enabled and the TCA is started. Inside the interrupt handler function, the LED is toggled. The result is that the amber LED0 on the AVR128DB48 Curiosity Nano development board is blinking with an equal period on and off (50% duty cycle).
6
+
This code example shows how to use single slope Pulse-Width Modulation (PWM) in the Timer/Counter A (TCA) on the AVR® DB Family of microcontrollers to generate overflow interrupts that toggle a LED. The time between each overflow interrupt is determined by the TCA clock prescaler selection and the value loaded into the period register. Then the overflow interrupt is enabled, and the TCA is started. Inside the interrupt handler function, the LED is toggled. The result is that the amber LED0 on the AVR128DB48 Curiosity Nano development board is blinking with an equal period on and off (50% duty cycle).
7
7
8
8

9
9
@@ -34,21 +34,23 @@ Microchip’s free MPLAB X IDE, compiler and MPLAB Code Configurator (MCC) graph
34
34
35
35
### Added Peripherals
36
36
37
-

37
+
Add the required peripherals: Timer Counter A (TCA0), Interrupt Manager, and Pin Register
38
+
39
+

38
40
39
41

40
42
41
43
### System Configuration: INTERRUPT MANAGER
42
44
43
-
In the INTERRUPT MANAGER, global interrupts is enabled. The interrupt assosiated with TCA0 (overflow) is enabled in the TCA0 confguration.
45
+
In the INTERRUPT MANAGER, global interrupts is enabled. The interrupt associated with TCA0 (overflow) is enabled in the TCA0 configuration.
The PINS configuration is made up of two boxes: the *Pins Grid View* and the *Pins* configuration box.
50
52
51
-
In the *Pins Grid View*, left-click on PORTB pin3 in the "Pin Module, GPIO, Output" row.
53
+
In the *Pins Grid View*, leftclick on PORTB pin3 in the "Pin Module, GPIO, Output" row.
52
54
53
55

54
56
@@ -63,36 +65,36 @@ In the *Pins* configuration box, now the pin you added will show (Pin Name = PB3
63
65
64
66

65
67
66
-
- Timer mode should be set to "16 Bit (Normal)" mode, as we are not using split mode operation (figure is taken from data sheet showing TCA normal mode operation).
68
+
- Timer mode should be set to "16 Bit (Normal)" mode, as we are not using split mode operation (figure is taken from [AVR128DB28/32/48/64 data sheet](http://www.microchip.com/DS40002247) showing TCA normal mode operation).
- Requested Timeout used in this example is 0.25s. For different periods, use a combination of Clock Selection and Requested Timeout to create the desired period (based on the Clock Selection prescaler value, the possible range for Requested Timeout will change, higer prescaler gives longer timeout options. The actual timeout will be calculated and shown in next line (this should be identical to Requested Timout in normal mode).
73
+
- Requested Timeout used in this example is 0.25s. For different periods, use a combination of Clock Selection and Requested Timeout to create the desired period (based on the Clock Selection prescaler value, the possible range for Requested Timeout will change, higher prescaler gives longer timeout options. The actual timeout will be calculated and shown in next line (this should be identical to Requested Timeout in normal mode).
72
74
- Turn on "Enable Overflow Interrupt" button to enable overflow interrupts from TCA0.
73
75
74
76

75
77
76
-
Now all configuration is complete. You have now enabled global interrupts, set PB3 as output in order to blink the LED and configured the timer (TCA0) to count up to a given value that gives you a certain time period (250 ms), then trigger an overflow interrupt. Next steps is setting up the hardware and programming the device.
78
+
Now all configuration is complete. You have now enabled global interrupts, set PB3 as output in order to blink the LED and configured the timer (TCA0) to count up to a given value that gives you a certain time period (250 ms), then trigger an overflow interrupt. Next steps are setting up the hardware and programming the device.
77
79
78
80
79
81
## Setup
80
82
81
83
- Connect the AVR128DB48 Curiosity Nano board to your computer using a USB cable
82
-
- Download and install all software components as listed under 'Software Used' (note that MPLAB Xpress IDE is an online tool that can not be downloaded)
84
+
- Download and install all software components as listed under 'Software Used' (note that MPLAB Xpress IDE is an online tool that cannot be downloaded)
83
85
84
86
85
87
## Operation
86
88
87
89
1. Download the zip file or clone the example to get the source code
88
90
1. Open the .X file with the MPLAB® X IDE
89
-
1. Set the project as Main project by right-clicking the project name in the *Projects* window (Ctrl+1) and select *"Set as Main Project"* from the drop-down menu
91
+
1. Set the project as Main project by rightclicking the project name in the *Projects* window (Ctrl+1) and select *"Set as Main Project"* from the drop-down menu
90
92
1. Program the project to the AVR128DB48 Curiosity Nano:
91
93
1. First clean and build the project by pressing the *Clean and Build Main Project* button
92
94
93
95

94
96
95
-
1. Then make and progam the project to the AVR128DB48 by clicking the *Make and Program Device Main Project* button
97
+
1. Then make and program the project to the AVR128DB48 by clicking the *Make and Program Device Main Project* button
0 commit comments