Monday, November 23, 2015

Getting Started with the Atmel Xplained Mini with the ATmega168PB MCU

In this video we give you an overview of the Atmel Xplained Mini which is a development board for the ATmega168PB microcontroller. In the video we cover how to load a simple "Blink" program onto the Xplained Mini with Atmel Studio and how the development board is compatible with Arduino Shields. The video is presented from the standpoint of an Arduino user. You can access the code from the video below.



//**************************Atmel Studio Code****************************
/*
 * ATmega168PB Example.c
 *
 * Created: 11/21/2015 4:59:24 PM
 * Author : ForceTronics
 */ 

#define F_CPU 16000000UL //Set the clock frequency
#include <avr/io.h> //call IO library
#include <util/delay.h> //call delay library

int main(void)
{
DDRB |= (1<<DDB5); //Set Port B 5 or PB5 or PCINT5 or pin 17 to output (1 is output and 0 is input)
while(1)
{
/*
PORTB |= (1<<PORTB5);    //Set PB5 to 1 which is high (LED on)
_delay_ms(1000);        //Delay for 1000ms or 1 sec
PORTB &= ~(1<<PORTB5);    //Set PB5 to 0 which is low (LED off)
_delay_ms(1000);        //Delay for 1000ms or 1 sec
*/
PINB |= (1<<PINB5);
_delay_ms(1000);        //Delay for 1000ms or 1 sec
}
}



No comments:

Post a Comment