충북인력개발원 전자과 공학박사 강원찬 2. Interrupt & LCD. uP AVR (Atmega128) - 2 -

Slides:



Advertisements
Similar presentations
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Advertisements

The Practice of Micro-processor Yonam Institute of Digital Technology 06. LCD Control.
C Examples 1.
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
An Embedded C Program 1 Mainly from textbook: Embedded C Programming and the Atmel AVR 2 nd Edition Barnett, Cox and O’Cull.
Eejit’s guide to using a LCD alphanumeric display with the CCS C compiler 1.Hardware connection 2.The LCD.C include file 3.An example.
Dr. Amr Talaat. #include ; /* this makes the header file for the PIC16f877 ready to be used in the C-class */ #define LED PORTC ; /* defines.
External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
Tachometer. Hardware Design -= Recall Atmega Interrupts internalExternalLCD.
Robotics Research Laboratory Louisiana State University.
Chapter 12 Capturing Input. Di Jasio - Programming 32-bit Microcontrollers in C Button Inputs.
Embedded Systems Programming 1 ETEE 3285 Topic HW3: Coding, Compiling, Simulating.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
RS232 #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
5. Serial Communication 충북인력개발원 전자과 공학박사 강원찬.
1 Lab 5: Controls and feedback. 2 Lab 5: Control and Feedback This embedded system uses the Photo sensor to detect the light intensity of the environment.
Instrumentation & Control Engg. Section Electrical Engineering Department Ahmedabad , Gujarat.
LCD Interfacing.
An Effective Method to Control Interrupt Handler for Data Race Detection Makoto Higashi †, Tetsuo Yamamoto ‡, Yasuhiro Hayase †, Takashi Ishio † and Katsuro.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
AVR Programming: Interrupts September 17, What are interrupts? An asynchronous signal indicating the need for an event to be handled A synchronous.
ATMEL AVR 8 bit RISC MICROCONTROLLERS a general comparison.
ECE 371 – Unit 9 Interrupts (continued). Example Set up Two Interrupt Request Inputs: –Port H[0] Set Interrupt Flag on “0” to “1” transition (rising edge)
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Interrupt. incoming Lab. Interrupt an asynchronous signal indicating the need for attention hardware interrupt/software interrupt call “interrupt service.
Example 11 Analog-to-Digital Converter Lecture L5.1.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
11. Temperature & Time 제어 충북인력개발원 전자과 공학박사 강원찬.
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.
Programming Microcontrollers in C Lecture L7.1. C Data Types TypeSizeRange char1 byte-128 – 127 unsigned char1 byte0 – 255 Int2 bytes – unsigned.
C Examples 1. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
C Examples 1. Download Links dsPIC30F4011/4012 Data Sheet dsPIC30F4013/3014 dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
충북인력개발원 전자과 공학박사 강원찬 3. Timer & Counter &PWM. uP AVR (Atmega128) PWM1=OC1A(PB5) PWM2=OC1B(PB6) T0=T1(PD6) T1=T2(PD7)
Microprocessors A practical approach Lesson 2 Hardware description and Delays.
CPUMemoryIO-1IO-2 Address BUS Data BUS Control BUS Memory Map IO Map 8bytes 2bytes IO-1 IO-2 A3~A0 D7~D0.
Embedded Programming and Robotics Lesson 11 Arduino Interrupts 1.
ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD.
Chap.6.3 UART.
GUIDED BY PROFFESOR NILESH DESAI GROUP NO:-8 CHANDRASHIKHA SINGH( ) KURUP SHUBHAM VALSALAN( ) SAURAV SHUBHAM( )
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
A.D.Patel institute of technology Sub : LCD and Keyboard interfacing with AVR. prepared by, chokshi abhi p ( ) Guided by, Prof. Asif Thakor.
Introduction to Projects using Microcontroller Md. Khalilur Rhaman Credit: Interface Lab.
Interfacing of Input/Output devices with AVR Microcontroller Enrolment No. : Name of the student: SOMAIYA ISHA.
Sensing Algorithm using IR Sensor and ADC Soong-sil University. Robotics 기 정 두 원.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
Microprocessors A practical approach..
Sitarambhai Naranjibhai Patel Institute of Technology and Research Centre, Umrakh, Bardoli. A Presentation On “ 16x2 LCD Interfacing with AVR atmega32.
INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE.
LCD Interfacing using Atmega 32
Microcontroller 8951S #interface-2.
Microprocessor Systems Design I
UNIVERSAL COLLEGE OF ENGINEERING & TECHNOLOGY
GANDHINAGAR INSTITUTE OF TECHNOLOGY
Example 19 Measuring Pulse Widths Using Interrupts
The Arduino Microcontroller: Atmel AVR Atmega 328
Session 3,4.
Timer/Counter Modified from Dr. Lam Phung’s Slides.
Example 15 Interrupt-Driven Controller
Interrupts in C Programs
Lecturer: Reza Arjmandi Autumn 2015
AVR Programming in C Chapter 7
Example 17 SCI Receive Interrupts
PIC16F887.  1.Microcontroller introducton  2.MPLAB,Hi-tech compilers  3.LED  4.Switches/push buttons  5.7-Segment Display  6.Keypad  7.LCD  8.Timers.
Presentation transcript:

충북인력개발원 전자과 공학박사 강원찬 2. Interrupt & LCD

uP AVR (Atmega128) - 2 -

uP AVR (Atmega128) - 3 -

uP AVR (Atmega128) 테스트 회로구성 AVR J53 J42 연결 PORTA J34 J30 연결

uP AVR (Atmega128) AVR Port B J29 연결

uP AVR (Atmega128) 새 프로젝트 생성 (File->New)

uP AVR (Atmega128) - 7 -

uP AVR (Atmega128) // External Interrupt 4 service routine interrupt [EXT_INT4] void ext_int4_isr(void) { // Place your code here } // External Interrupt 5 service routine interrupt [EXT_INT5] void ext_int5_isr(void) { // Place your code here } EICRA=0x00; EICRB=0x0F; // INT4/5 Mode: Rising Edge EIMSK=0x30; EIFR=0x30; // Global enable interrupts #asm("sei")

uP AVR (Atmega128) #include // Declare your global variables here unsigned char led=0x0f; unsigned detect=0x00; // External Interrupt 4 service routine interrupt [EXT_INT4] void ext_int4_isr(void) {// Place your code here detect=1; } // External Interrupt 5 service routine interrupt [EXT_INT5] void ext_int5_isr(void) {// Place your code here detect=2; }

uP AVR (Atmega128) while (1) { if(detect==0) { for(i=0;i<8;i++) { PORTB=led++; PORTA.7=1; PORTA.6=1; delay_ms(100); } } if(detect==1) {PORTB=0xf0; PORTA.6=0; delay_ms(1000); detect=0; } if(detect==2) {PORTB=0x0f; PORTA.7=0; delay_ms(1000); detect=0; } };

uP AVR (Atmega128) 연습문제 1) SW1~SW6 각 키별 각기 다른 개별 동작을 구현하세요. ( 구별 입력 ) 2) SW1-SW2 동시 입력시 각 키별 각기 다른 개별 동작을 구현하세요.( 통합 입력 ) 3) SW3-SW6 16 가지 입력 상태에 따라 LED 점등 상태로 구별하세요.( 통합입력 )

uP AVR (Atmega128) PORTA J30 연결

uP AVR (Atmega128) PORTC J19 연결 [LCD][AVR Port] RS (pin4) bit 0 RD (pin 5) bit 1 EN (pin 6) bit 2 DB4 (pin 11) ---bit 4 DB5 (pin 12) ---bit 5 DB6 (pin 13) ---bit 6 DB7 (pin 14) ---bit 7

uP AVR (Atmega128)

uP AVR (Atmega128) PORTC=0x00; DDRC=0xFF;

uP AVR (Atmega128) #include // Alphanumeric LCD Module functions #asm.equ __lcd_port=0x15 #endasm #include // 자동삽입 루틴 ============================ // LCD module initialization lcd_init(16); // 자동삽입 루틴 while (1) {};

uP AVR (Atmega128) LCD Function void _lcd_ready(void) void _lcd_write_data(unsigned char data) void lcd_write_byte(unsigned char addr, unsigned char data); unsigned char lcd_read_byte(unsigned char addr); void lcd_init(unsigned char lcd_columns) void lcd_clear(void) void lcd_gotoxy(unsigned char x, unsigned char y) void lcd_putchar(char c) void lcd_puts(char *str)//SRAM 영역에 데이터 존재 void lcd_putsf(char flash *str) //FLASH 에 데이터존재 ** 적색으로 기재된 명령은 외우세요 !!

uP AVR (Atmega128) // LCD module initialization lcd_init(16); lcd_gotoxy(0,0); lcd_putsf("LCD test....!"); lcd_gotoxy(0,1); //lcd_data="Now Initialize..."; sprintf(lcd_data,"%s",d1); // lcd_puts(lcd_data); ** ED-4512 키트에서는 호환성 무시되어 사용할 수 없음. 따라서 모든 함수를 무식하게 만들어야 함.

uP AVR (Atmega128) #include #include #include #include // Alphanumeric LCD Module functions #asm.equ __lcd_port=0x15 ;PORTC #endasm // Declare your global variables here char dd[17]=" ";

uP AVR (Atmega128) Void main(void) { Int i; lcd_init(16); lcd_gotoxy(0,0); lcd_putsf(“LCD Test….. "); lcd_gotoxy(0,1); lcd_putsf("press any key..."); delay_ms(3000);

uP AVR (Atmega128) while (1) { for(i=0;i<100;i++) { sprintf(dd,”Time is %3d sec..”, i); lcd_gotoxy(0,1); lcd_puts(dd); delay_ms(1000); } }; }

uP AVR (Atmega128) 연습문제 1) LCD 에 5 초 간격으로 2 라인씩 글자를 출력 하도록 구현하시오. 2) SW1 을 누르면 카우트 시작, SW2 를 누르면 중지하는 스톱워치를 구현하시오 3) LCD 에 눌려진 키값을 출력하고, LED 로도 다양하게 표현하시오.

uP AVR (Atmega128) 끝--끝-