introduction to avr & development environment setting
DESCRIPTION
Introduction to AVR & Development Environment Setting. Microcomputer. a computer with a microprocessor as its central processing unit personal computer or computer c.f.) mainframe, minicomputer as a subject Computer architecture Assembler Memory Interface I/O Interface …. microprocessor. - PowerPoint PPT PresentationTRANSCRIPT
Introduction to AVR &Development Environment
Setting
incoming Lab.incoming Lab.
Microcomputer
a computer with a microprocessor as its central processing unit
personal computer or computerc.f.) mainframe, minicomputer
as a subjectComputer architectureAssemblerMemory InterfaceI/O Interface…
incoming Lab.incoming Lab.
microprocessor
A microprocessor incorporates most or all of the functions of a computer's central processing unit (CPU) on a single integrated circuit (IC, or microchip).
General purpose Pentium, AMD, MC68000, …
Digital Signal Processor (DSP) optimized specifically for digital signal processing
Advanced RISC Machine(ARM) processor mobile and embedded electronics
Micro-controller(MCU) designed for embedded applications
…
* CPU : carries out the instructions of a computer program.
incoming Lab.incoming Lab.
Micro-Controller
a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals µC or MCU(micro-controller unit)시스템 내부의 칩 개수를 줄여줌으로써 , 가볍고 작은 시스템을 만들 수 있게 해준다가격을 최적화할 수 있으며 , 제품의 개발기간을 줄여줄 수 있다8051(Intel), AVR(Atmel), PIC(Microchip Tech.) , …
incoming Lab.incoming Lab.
AVR micro-controller
a modified Harvard architecture 8-bit RISC single chip micro-controller (Atmel) architecture was conceived by two students at the Norwegian Institute of Technology (NTH) Alf-Egil Bogen and Vegard Wollanfirst microcontroller families to use on-chip flash memory for program storage megaAVR — the ATmega series
4–256 kB program memory28–100-pin packageExtended instruction setExtensive peripheral set
ATmega128 : 128K program memory
incoming Lab.incoming Lab.
von Neumann architecture
both cannot occur at the same time
Harvard architecture vs. von Neumann architecture
Harvard architectureCPU can both read an instruction and perform a data memory access at the same time
incoming Lab.incoming Lab.
RISC vs. CISC
RISC Reduced Instruction Set Computinga CPU design strategy based on the insight that simplified (as opposed to complex) instructions can provide higher performance if this simplicity enables much faster execution of each instruction
CISCComplex Instruction Set Computingeach instruction can execute several low-level operations, such as a load from memory, an arithmetic operation, and a memory store, all in a single instruction
incoming Lab.incoming Lab.
Pinout of ATmega128
TQFP : thin quad flat pack
c.f) MLF : Micro Lead Frame
incoming Lab.incoming Lab.
Internal Architecture of ATmega128
incoming Lab.incoming Lab.
Development Environment
프로그램컴파일다운로드 실행
AVR Studio : 프로그램 , 다운로드 Win AVR : 컴파일USB ISP : 다운로드 (USB driver)
incoming Lab.incoming Lab.
AVR Studio 내려받기
http://www.atmel.com
Download AVR Studio 4.18Register required
DatasheetATmega128
incoming Lab.incoming Lab.
WinAVR 내려받기
http://sourceforge.net/projects/winavr/files/
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
AVR Studio 설치처음 단계에서 아래와 같은 초기 화면이 표시[ 다음 ] 선택하고 License Agreement 화면에서 Accept
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
소프트웨어 설치 경로 지정AVR Studio 에서 이용하게 되는 USB 포트 드라이브 설치
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
설치에 대한 모든 설정항목이 완료되었고 설치를 진행함을 알리는 화면
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
모든 설치가 완료되었음을 알리는 화면
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
WinAVR 설치하기초기 화면에서 설치 시 표시될 언어를 선택하는 화면[KOREA] 선택 후 환인 버튼
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
WinAVR 에 대한 라이센스에 동의를 구하는 화면기본 설치 경로 사용
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
기본으로 설정된 구성요소 선택 후 [ 설치 ] 선택프로그래밍 설치되는 과정 수분의 시간이 소요
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
설치가 완료되었음을 알리는 화면[ 시작 ]-[ 프로그램 ]–[Atmel AVR Tools] 폴더 확인
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
Usb ISP 프로그래머 설치프로그램을 컴파일 시 AVR 마이크로컨트롤러에서 동작을 시킬 수 있는 실행 파일이 만들어짐실행 파일을 AVR 마이크로컨트롤러의 프로그램 메모리 , 즉 플래쉬 메모리로 옮겨 적재시키는 작업 ( 다운로딩 ) 을 위한 드라이버 설치
장비에 USB Connector A to B Type 을 이용하여 컴퓨터의 USB Port 에 연결
AVR ISP Programmer 장치를 Connector 와 연결 드라이버는 다음과 같은 사이트를 방문 후 절차대로 설치함
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
VCP 설치http://www.ftdichip.com/Drivers/VCP.htm해당 사이트로부터 CDM 2.00.00.zip 파일을 다운로드
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
HBE-MCU-Multi 의 AVR ISP Programmer 를 PC 의 USB포트에 연결연결 후 새 하드웨어 검색 마법사에서 설치“ 목록 또는 특정 위치에서 설치 ( 고급 )”을 선택 후 [ 다음 ] 클릭 후 [ 찾아보기 ] 클릭하여 CDM 2.00.00 을 찾아 선택
incoming Lab.incoming Lab.
개발환경 설치개발환경 설치
[ 마침 ] 클릭하여 드라이버 설치 종료
incoming Lab.incoming Lab.
HBE-RoboMotor-SE 실습환경
incoming Lab.incoming Lab.
HBE-RoboMotor-SE 실습 준비
마이크로프로세서 파트 (MCU Part) 의 상태를 체크 .① MCU /Module 스위치 상태를 MCU 상태로 유지② Auto/User 스위치 상태를 User 상태로 유지③ AD Port/JTAG 스위치 상태를 JTAG 상태로 유지
MCU Part 의 ISP 와 AVR-ISP Programmer 와 연결AVR-ISP Programmer 와 PC 연결AVR-ISP Programmer 의 mode 는 ISP
incoming Lab.incoming Lab.27
개발환경 사용개발환경 사용
AVR Studio 처음 실행Atmel 사의 AVR Studio 를 처음 사용하는 사용자를 위해 간단한 예제를 이용작성한 코드를 컴파일하고 이를 장비에 프로그램하는 과정을 진행[ 시작 ]-[ 프로그램 ]-[Atmel AVR Tools]-[AVR Studio4] 선택
incoming Lab.incoming Lab.28
개발환경 사용개발환경 사용
프로그램 초기 화면에서는 AVR Project 를 생성하거나 이미 만들어진 프로젝트를 오픈하는 화면이 표시됨[New Project] 선택
incoming Lab.incoming Lab.29
개발환경 사용개발환경 사용
Project 생성에 필요한 항목 지정하는 화면Project name 과 Create folder, Initial file, 프로젝트를 저장할 폴더의 Location 등 설정Debug platform : JTAG ICE 설정Device : ATmega128 설정
incoming Lab.incoming Lab.30
개발환경 사용개발환경 사용
기본 프로젝트 생성 완료 후 AVR Studio 메인화면이 표시됨화면에는 공란의 Getting_Start.c 파일이 표시다음과 같은 코드를 입력
#include<avr/io.h>int main(){ DDRB = 0xFF; DDRD = 0x00; while(1){ if(PIND & 0x40) PORTB |= 0x20; else PORTB &= ~0x20;
if(PIND & 0x80) PORTB |= 0x40; else PORTB &= ~0x40; } return 0; }
incoming Lab.incoming Lab.31
개발환경 사용개발환경 사용
#include<avr/io.h>
int main(){
DDRB = 0xFF; DDRD = 0x00;
while(1){ if(PIND & 0x40) PORTB |= 0x20; else PORTB &= ~0x20;
if(PIND & 0x80) PORTB |= 0x40; else PORTB &= ~0x40; } return 0; }
incoming Lab.incoming Lab.32
개발환경 사용개발환경 사용
코드 입력 후 [Build]-[Build] 선택하여 코드를 컴파일 및 프로그램 파일을 생성하는 과정 수행정상적으로 Build 수행 후 프로그램 코드를 다운로드 진행화면 상단 중앙에 [Con] 아이콘을 선택
incoming Lab.incoming Lab.33
개발환경 사용개발환경 사용
AVR 디바이스를 프로그램하기 위한 프로그래머 선택Plaform : STK500 or AVRISP 선택Port : 프로그래머가 연결된 포트 선택 ( 장치관리자 참조 )[Connect] 선택
incoming Lab.incoming Lab.34
개발환경 사용개발환경 사용
Device : ATmega128 선택Programming mode : ISP mode 선택Build 과정에서 프로그램 다운로드에 필요한 HEX 파일이 프로젝터 폴더에 있는 ‘ default’라는 폴더에 만들어짐HEX 파일을 Flash 항목에 입력[Program] 선택 하면 프로그램 다운로드가 진행프로그램 다운로드가 완료되면 아래의 메시지 창에 다운로드가 정상적으로 완료되었음을 알림
incoming Lab.incoming Lab.35
개발환경 사용개발환경 사용
incoming Lab.incoming Lab.36
개발환경 사용개발환경 사용
AVR Device 설정을 위한 Fuse 과정을 수행AVR Device 의 동작을 설정하는 항목설정 후 [Program] 선택