Interrupt Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 Button Interrupt Uart Interrupt 2.

Slides:



Advertisements
Similar presentations
UNIT 13 Interrupt 로봇 SW 교육원 조용수.
Advertisements

void count_down (int count) { for(i=count; i>1; i--) printf(" %d\t", count); } printf("A%d\n", count); if(count>1) count_down(count-1); printf("B%d\n",
UNIT 10 GPIO Test 로봇 SW 교육원 조용수.
UNIT 04 Nuvoton MCU 로봇 SW 교육원 조용수.
C Examples 1.
AD Converter UNIT 19 로봇 SW 교육원 조용수. 학습 목표 AD Converter AD Converter Register 2.
UNIT 20 AD Converter Test 로봇 SW 교육원 조용수.
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
ColdFire MCF5282 Universal Asynchronous Receiver/Transmitters (UARTs)
Lecture 10 Serial Communication.
Lecture 9 Timer Operations and Programming. 2  Introduction  Summary of timers  Timer programming sequence  Summary of timer SFRs  Timer 0: 8-bit.
Chapter 12 Capturing Input. Di Jasio - Programming 32-bit Microcontrollers in C Button Inputs.
I2C UNIT 23 로봇 SW 교육원 조용수. 학습 목표 I2C I2C Protocol 구조 N051 I2C 동작 I2C Register 2.
UART Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 UART Init UART Send UART Receive UART -> Debugging Console Up/Down Game 제작 2.
V 0.91 Polled IO versus Interrupt Driven IO Polled Input/Output (IO) – processor continually checks IO device to see if it is ready for data transfer –Inefficient,
Industrial Reference Design Platform RS-232 Interface Developed by the TSC Americas Release 1.0.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
PWM UNIT 17 로봇 SW 교육원 조용수. 학습 목표 PWM PWM Register 2.
1 LHO 13 The 8051CF020 and the University Daughter Card.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
Arch1 LCD Lab Eric Freudenthal. Topics Score Demo LCD Panel Geometry Utilities to draw to the display Drawing characters Buttons Nuisance: multiple versions.
UNIT 29 MCU Project 로봇 SW 교육원 조용수.
Universal Asynchronous Receiver/Transmitter (UART)
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)
로봇 모니터링 1/2 UNIT 20 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Message Queue Handler 2.
LAB 12: Timer and Interrupt Chung-Ta King National Tsing Hua University CS 4101 Introduction to Embedded Systems.
ECS642U Embedded Systems Interrupts in Cyclic Systems William Marsh.
UNIT 11 UART 로봇 SW 교육원 조용수.
Albert Board UNIT 27 로봇 SW 교육원 조용수. Albert Board ISD 9160 Albert Board Connection Albert Board 용 SW 설치 Sample Source 동작 2.
1 ARM University Program Copyright © ARM Ltd 2013 Using Direct Memory Access to Improve Performance.
SPI Test UNIT 26 로봇 SW 교육원 조용수. 학습 목표 SPI Sample SPI Read/Write Function SPI loop back Test MPL115A1 Pressure and Temperature Sensor 2.
PPI-8255.
Input Interface – Microprocessor
This material exempt per Department of Commerce license exception TSU Architecture Wizard and PACE Lab 2 Introduction.
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
Chapter 5 - Interrupts.
C Examples 1. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
PWM Test 2 UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Servo 제어 2.
Comunicación Serie.
System Control & Clock UNIT 08 로봇 SW 교육원 조용수. 학습 목표 System Control Register System Clock CMSIS CMSIS Project 2.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
WCL 조윤정 Arduino Bootloader 코드 분석. BAUD_RATE 설정 /* set the UART baud rate defaults */ #ifndef BAUD_RATE #if F_CPU >= L #define BAUD_RATE.
Timer & Watch Dog Test UNIT 16 로봇 SW 교육원 조용수. 학습 목표 Timer Init Timer Delay Test Timer Interrupt Test –One Shot Mode –Periodic Mode Watch Dog Test 시계 만들어.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
INDEX Introduction System Control Block Vectored Interrupt Controller (VIC) GPIO UART Timers.
Microprocessors A practical approach..
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
PWM Test UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Init PWM LED 제어 2.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
Chip Config & Drivers – Required Drivers:
Homework Reading Machine Projects
Lab 7 Basic 1: Game of Memory
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
CS-401 Computer Architecture & Assembly Language Programming
Cortex-M0 MCU Clocks & Pins
Source: Serial Port Source:
Interrupt Source: under
Homework Reading Machine Projects Labs
Introduction to Micro Controllers & Embedded System Design I/O Processing and Serial Port Operation Department of Electrical & Computer Engineering Missouri.
Chapter 11 Multiple interrupts
Timer Operations and Programming
How to use peripherals on MCB1700
Interrupt and Exception Programming
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
Interrupt Source: under
Source: Serial Port Source:
UNIT 26 SPI Test 로봇 SW 교육원 조용수.
AVR UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible.
Presentation transcript:

Interrupt Test UNIT 14 로봇 SW 교육원 조용수

학습 목표 Button Interrupt Uart Interrupt 2

Button(EINT0) Interrupt EINT0 인터럽트 활성화 –Interrupt Controller 설정 //NVIC_EnableIRQ(EINT0_IRQn); NVIC->ISER[0] = (0x1 << 2); –GPIO Port 설정 //GPIO_EnableInt(P3, 2, GPIO_INT_FALLING); P3->IEN |= 0x1 << 2 ; P3->IMD &= ~(0x1 << 2); 3

Button(EINT0) Interrupt EINT0 Handler 설정 4 ; External Interrupts ; maximum of 32 External Interrupts are possible DCD BOD_IRQHandler DCD WDT_IRQHandler DCD EINT0_IRQHandler DCD EINT1_IRQHandler DCD GPIOP0P1_IRQHandler DCD GPIOP2P3P4_IRQHandler

Button(EINT0) Interrupt EINT0 Handler 설정 5 void EINT0_IRQHandler() { int32_t value = P2->PIN; P2->DOUT = ~(value); P3->ISRC = 0x4; }

Button(EINT0) Interrupt EINT0 Interrupt Enable 설정 6 int main() { SYS->P3_MFP &= ~(0x0404); SYS->P3_MFP |= SYS_MFP_P32_INT0; //GPIO_SetMode(P3, BIT6, GPIO_PMD_INPUT); P3->PMD &= ~(0x3 << 4); P3->PMD |= (0x3 << 4); //GPIO_EnableInt(P3, 2, GPIO_INT_FALLING); P3->IEN |= 0x1 << 2 ; P3->IMD &= ~(0x1 << 2); //NVIC_EnableIRQ(EINT0_IRQn); NVIC->ISER[0] = (0x1 << 2); while(1) { }

Button(EINT0) Interrupt EINT0 De-Bounce 설정 7 int main() { /* Debounce function control */ GPIO->DBNCECON &= ~(0xF); GPIO->DBNCECON |= GPIO_DBCLKSEL_1024; //GPIO_ENABLE_DEBOUNCE(P3, BIT2 ); P3->DBEN |= 0x1 << 2; … while(1) { }

UART Interrupt Uart Interrupt 를 이용하여 RX 테스트 8 void UART0_Init() { /* Configure UART0 and set UART0 Baudrate */ UART_Open(UART0, ); //UART0->FCR |= (0x02 << 4); // Fifo Interrupt Trigger : 8 Byte // Receive Interrrupt Enable; UART0->IER |= 0x1; }

UART Interrupt Uart Interrupt 를 이용하여 RX 테스트 9 void UART0_IRQHandler() { int value = UART0->ISR ; int count = 0; int ch; if(value & 0x1) { // Receive Data Available count = (UART0->FSR & 0x0F00) >> 8 ; ch =UartRead(); printf("%c", ch); printf(" C:%d\n", count); } if(value & 0x2) { // Transmit Register Empty }

UART Interrupt Uart Interrupt Enable 10 int main(void) { int8_t ch; /* Init System, IP clock and multi-function I/O */ SYS_Init(); /* Init UART0 for printf */ UART0_Init(); //NVIC_EnableIRQ(UART0_IRQn); NVIC->ISER[0] = (0x1 << 12); while(1); }

GPIO & UART 게임을 Interrupt 로 러시안 룰렛 게임의 버튼 입력을 Interrupt 로 변경 Up/Down 게임에서 Uart Interrupt 를 사용 11

GPIO & UART 게임을 Interrupt 로 러시안 룰렛 게임의 버튼 입력을 Interrupt 로 변경 12 void EINT0_IRQHandler() { result --; if(result <= 0) { printf(" You are dead!!! \n"); P2->DOUT = 0x00; result = rand() % 6; printf("Start New Game \n"); } else { P2->DOUT = 0xFF; printf(" You are alive!!! \n"); } // Interrupt Pending Clear P3->ISRC = 0x4; }

GPIO & UART 게임을 Interrupt 로 Up/Down 게임에서 Uart Interrupt 를 사용 13 void UART0_IRQHandler() { int value = UART0->ISR ; int count = 0; int ch, input; if(value & 0x1) { // Receive Data Available count = (UART0->FSR & 0x0F00) >> 8 ; printf("Input: "); ch =UART0->DATA; printf("%c", ch); // Game input = ch - 0x30 ; // ASCII To Int if(input > 10) { printf("Please Input Number \n"); }else if(input < result ) { printf(" -> Low !!!\n"); } else if(input > result) { printf(" -> High !! \n"); } else { printf(" Correct!!! %d\n\n", result); result = rand() % 10; printf("Start New Game \n\n"); } if(value & 0x2) { // Transmit Register Empty }

GPIO & UART 게임을 Interrupt 로 Up/Down 게임에서 Uart Interrupt 를 사용 14 void UART0_Init() { /* Configure UART0 and set UART0 Baudrate */ UART_Open(UART0, ); // Receive Interrrupt Enable; UART0->IER |= 0x1; } int main(void) { int8_t ch; /* Init System, IP clock and multi-function I/O */ SYS_Init(); UART0_Init(); NVIC->ISER[0] = (0x1 << 12); printf("Start New Game \n\n"); result = rand() % 10; while(1); }