Skip to content

microchip-pic-avr-examples/atmega328pb-basic-peripherals-mplab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCHP

Basic Peripherals

This application uses the ADC to measure an analog input voltage, typically from a potmeter. It uses the sampled value to control the PWM duty cycle of an I/O pin, typically connected to a LED. The printf() will be redirected to USART to print status information, while the Timeout Driver schedules the timing of these operations. This results in a LED dimmer and printf() application.

Related Documentation

Software Used

Hardware Used

Setup

  1. Connect ADC Channel 0 (PC0) to analog input voltage source, such as potmeter.

  2. Connect PWM Channel 0 (PD6) to observable output, such as a LED.

Operation

  1. Connect the board to the PC.

  2. Download the zip file or clone the example to get the source code.

  3. Open the project in MPLAB X IDE.

  4. Build the solution and program the device.

  5. Open the EDBG COM-port in a terminal window to observe the printf() output.

  6. Operate the analog input voltage source (e.g. potmeter) and observe the change in LED and printf() output.

Conclusion

This code example has illustrated how to use basic peripherals of the ATmega328PB to create a LED dimmer and printf() application.

About

This repository will introduce basic peripherals of the ATmega328PB such as ADC, PWM and USART.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages