Skip to content

Commit 6e22821

Browse files
Erling Holten WikenErling Holten Wiken
authored andcommitted
MPAE-12175: updates after PR review #1
1 parent 5cf2f46 commit 6e22821

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Blink with Timer Overflow
55

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).
77

88
![cnano](images/avr128db48_cnano_board.png)
99

@@ -34,21 +34,23 @@ Microchip’s free MPLAB X IDE, compiler and MPLAB Code Configurator (MCC) graph
3434

3535
### Added Peripherals
3636

37-
![Pheripherals](images/peripherals.png)
37+
Add the required peripherals: Timer Counter A (TCA0), Interrupt Manager, and Pin Register
38+
39+
![Peripherals](images/peripherals.png)
3840

3941
![system_cfg](images/config_overview.png)
4042

4143
### System Configuration: INTERRUPT MANAGER
4244

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.
4446

4547
![Interrupts](images/interrupt_manager_needupdate.png)
4648

4749
### System Configuration: PINS
4850

4951
The PINS configuration is made up of two boxes: the *Pins Grid View* and the *Pins* configuration box.
5052

51-
In the *Pins Grid View*, left-click on PORTB pin3 in the "Pin Module, GPIO, Output" row.
53+
In the *Pins Grid View*, left click on PORTB pin3 in the "Pin Module, GPIO, Output" row.
5254

5355
![pins_grid](images/pin_grid.png)
5456

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

6466
![clk_cfg](images/clk_cfg.png)
6567

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).
6769

6870
![tca_normalmode_fig](images/tca0_normal_mode_fig.png)
6971

7072
- Count Direction should be "UP".
71-
- 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).
7274
- Turn on "Enable Overflow Interrupt" button to enable overflow interrupts from TCA0.
7375

7476
![tca0](images/TCA0_needsupdate.png)
7577

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.
7779

7880

7981
## Setup
8082

8183
- 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)
8385

8486

8587
## Operation
8688

8789
1. Download the zip file or clone the example to get the source code
8890
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 right clicking the project name in the *Projects* window (Ctrl+1) and select *"Set as Main Project"* from the drop-down menu
9092
1. Program the project to the AVR128DB48 Curiosity Nano:
9193
1. First clean and build the project by pressing the *Clean and Build Main Project* button
9294

9395
![clean_and_build](images/clean_and_build.png)
9496

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
9698

9799
![make_and_prog](images/make_and_prog.png)
98100

images/peripherals.png

115 KB
Loading

0 commit comments

Comments
 (0)