UART Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 UART Init UART Send UART Receive UART -> Debugging Console Up/Down Game 제작 2.

Slides:



Advertisements
Similar presentations
Jim Chen ( 14/06/2011 Hytec Electronics Ltd.
Advertisements

UNIT 10 GPIO Test 로봇 SW 교육원 조용수.
Interrupt Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 Button Interrupt Uart Interrupt 2.
C Examples 1.
Lab 8 User Defined Function.
Interrupt Controller Introduction to 8259.
AD Converter UNIT 19 로봇 SW 교육원 조용수. 학습 목표 AD Converter AD Converter Register 2.
UNIT 20 AD Converter Test 로봇 SW 교육원 조용수.
RS-232 Port Discussion D7.1. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
NIOS II Ethernet Communication Final Presentation
USART and Asynchrono us Communica tion The USART is used for synchronous and asynchronous serial communication. USART = Universal Synchronous/Asynchronous.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
C - Input & Output When we are saying Input that means to feed some data into program. This can be given in the form of file or from command line. C programming.
I2C UNIT 23 로봇 SW 교육원 조용수. 학습 목표 I2C I2C Protocol 구조 N051 I2C 동작 I2C Register 2.
Pulse Width Modulation
로봇 모니터링 2/2 UNIT 21 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Broadcasting Service 2.
F.F. - 18/07/ User Guide of the Input Trigger Multiplexer unit with input signal rate counters.
로봇 전화번호부 4/4 UNIT 12 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 뷰 홀더 패턴을 사용할 수 있다. 토스트를 사용할 수 있다. 클릭 이벤트를 처리할 수 있다. 2.
Industrial Reference Design Platform RS-232 Interface Developed by the TSC Americas Release 1.0.
UART: Universal Asynchronous RX/TX
Principles of Programming - NI Simple Recursion Recursion is where a function calls itself. Concept of recursive function: A recursive function is.
Principles of Programming Chapter 11: Recursive Function  In this chapter, you will learn about  Recursion function 1 NI S1 2009/10.
Computer Programming for Engineers. Outline Tic-Tac-Toe (O-X Game) Drawing 3x3 grid Receiving the inputs Checking for a winner Taking turns between.
LAB 8: Program Design Pattern and Software Architecture
PWM UNIT 17 로봇 SW 교육원 조용수. 학습 목표 PWM PWM Register 2.
로봇을 조종하자 3/4 UNIT 17 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 스마트 폰의 센서를 사용할 수 있다. 2.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
UNIT 29 MCU Project 로봇 SW 교육원 조용수.
C Examples 5. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
NS Training Hardware. Serial Controller - UART.
로봇 모션 편집기 4/4 UNIT 25 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 에디트 텍스트를 사용할 수 있다. 아이템을 삭제할 수 있다. 아이템을 편집할 수 있다. 2.
Universal Asynchronous Receiver/Transmitter (UART)
로봇 모니터링 1/2 UNIT 20 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Message Queue Handler 2.
UNIT 30 네트워크 전송 2 로봇 SW 콘텐츠 교육원 조용수.
UNIT 11 UART 로봇 SW 교육원 조용수.
Albert Board UNIT 27 로봇 SW 교육원 조용수. Albert Board ISD 9160 Albert Board Connection Albert Board 용 SW 설치 Sample Source 동작 2.
SPI Test UNIT 26 로봇 SW 교육원 조용수. 학습 목표 SPI Sample SPI Read/Write Function SPI loop back Test MPL115A1 Pressure and Temperature Sensor 2.
Humble Hubble Team 18 Tim Brown. Abstract The proposed project is a self-aiming telescope. This telescope will obtain its global position and the local.
네트워크 전송 1/2 UNIT 29 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Android Network 통신 2.
Principles of Programming - NI Simple Recursion Recursion is where a function calls itself. Concept of recursive function: A recursive function is.
로봇을 조종하자 4/4 UNIT 18 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Intent Activity 호출 2.
PWM Test 2 UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Servo 제어 2.
로봇을 조종하자 1/5 UNIT 14 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 터치 이벤트를 처리할 수 있다. 2.
System Control & Clock UNIT 08 로봇 SW 교육원 조용수. 학습 목표 System Control Register System Clock CMSIS CMSIS Project 2.
Custom Widget 2 UNIT 27 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Custom Widget –Canvas 를 이용하여 Custom Widget 을 만든다. 2.
Presented by: © 2015 Jacob Beningo All Rights Reserved Writing Portable and Robust Firmware in C September 2, 2015 Jacob Beningo, CSDP Class 3: Uart Driver.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
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 시계 만들어.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
NuMicro Cortex-M0 PDMA. 议题 特性 方块图 功能描述 示例 特性 九通道 DMA (Peripheral-to-Memory or Memory-to- Peripheral or Memory-to-Memory) 一个内部 word buffer 源和目的地址有两种选择.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 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.
Homework Reading Machine Projects
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
EMBEDDED SYSTEMS UNIT 4.
Morse code lab Pseudo code: Start code; define variables
Cortex-M0 MCU Clocks & Pins
ESP8266 Tutorial (Web server)
Slave cores Etherbone Accessible device Etherbone Accessible device E
Introduction to Micro Controllers & Embedded System Design I/O Processing and Serial Port Operation Department of Electrical & Computer Engineering Missouri.
Example 13 The Serial Peripheral Interface (SPI)
UNIT 08 그림책 만들기 2/2 로봇 SW 콘텐츠 교육원 조용수.
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
Extra Practice for Recursion
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
UNIT 26 SPI Test 로봇 SW 교육원 조용수.
CSCE 206 Lab Structured Programming in C
Presentation transcript:

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

학습 목표 UART Init UART Send UART Receive UART -> Debugging Console Up/Down Game 제작 2

UART Init 통신에 사용할 속도 및 UART Clock Enable 3 void SYS_Init(void) { SYS_UnlockReg(); CLK->APBCLK = CLK_APBCLK_UART0_EN_Msk; SystemCoreClockUpdate(); SYS->P3_MFP = SYS_MFP_P30_RXD0 | SYS_MFP_P31_TXD0; SYS_LockReg(); } void UART0_Init() { /* Configure UART0 and set UART0 Baudrate */ UART_Open(UART0, ); }

UART Send TX Fifo 가 비어 있는지 체크 Tx Fifo 에 데이터 추가 4 void UartSend(int ch) { while(UART0->FSR & UART_FSR_TX_FULL_Msk); UART0->DATA = ch; if(ch == '\n') { while(UART0->FSR & UART_FSR_TX_FULL_Msk); UART0->DATA = '\r'; }

UART Receive Rx Fifo 에 데이터가 저장이 되는지 체크 Rx Data Read! 5 int UartRead() { int ch; while(UART0->FSR & UART_FSR_RX_EMPTY_Msk); ch =UART0->DATA; return ch; }

UART 로 내부 정보 전달 1.Echo 출력 6

UART 로 내부 정보 전달 1.Echo 출력 7 do { ch =UartRead(); UartSend(ch); } while(1);

UART Debugging Console Semihosting ? Retarget.c 추가 –Printf 등의 표준 입출력 함수 사용 가능 8

UART 로 내부 정보 전달 1.CPU ID 출력 9

UART 로 내부 정보 전달 1.CPU ID 출력 10 printf("PDID 0x%x \n", SYS->PDID);

UART 로 게임 만들기 1.Up / Down Game 만들기 11 #include #include "M051Series.h" // retarget.c 를 사용해야 printf 사용 가능해짐 void SYS_Init(void) { /* Unlock protected registers */ SYS_UnlockReg(); /* Enable IP clock */ CLK->APBCLK = CLK_APBCLK_UART0_EN_Msk; /* Update System Core Clock */ /* User can use SystemCoreClockUpdate() to calculate SystemCoreClock and cyclesPerUs automatically. */ SystemCoreClockUpdate(); /* Set P3 multi-function pins for UART0 RXD and TXD */ SYS->P3_MFP = SYS_MFP_P30_RXD0 | SYS_MFP_P31_TXD0; /* Lock protected registers */ SYS_LockReg(); }

UART 로 게임 만들기 12 void UART0_Init() { /* Configure UART0 and set UART0 Baudrate */ UART_Open(UART0, ); } void UartSend(int ch) { while(UART0->FSR & UART_FSR_TX_FULL_Msk); UART0->DATA = ch; if(ch == '\n') { while(UART0->FSR & UART_FSR_TX_FULL_Msk); UART0->DATA = '\r'; } int UartRead() { int ch; while(UART0->FSR & UART_FSR_RX_EMPTY_Msk); ch =UART0->DATA; return ch; }

UART 로 게임 만들기 13 int main(void) { int8_t ch; int8_t isStart = -1; int8_t result = -1; SYS_Init(); /* Init UART0 for printf */ UART0_Init(); do { printf("Input: "); ch =UartRead(); if(ch == 's') { printf("Start Game\r\n"); isStart = 1; result = rand() % 10; } else { if(isStart > 0) { int 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); isStart = -1; } } else { // Game Over printf("Input : %c\n", ch); } while(1); }