UNIT 20 AD Converter Test 로봇 SW 교육원 조용수.

Slides:



Advertisements
Similar presentations
UNIT 10 GPIO Test 로봇 SW 교육원 조용수.
Advertisements

Interrupt Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 Button Interrupt Uart Interrupt 2.
Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.
MSP430G2553 launchpad and MPU6050 Introduction
C Examples 1.
Chung-Ta King National Tsing Hua University
Digital Thermostat and Data Logger Brandon Wagner and David Southwick.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
Analog to Digital Conversion
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Analog Comparator Positive input chooses bet. PB2 and Bandgap Reference. Negative input chooses bet. PB3 and the 8 inputs of the A/D. ACME= Analog Comparator.
AD Converter UNIT 19 로봇 SW 교육원 조용수. 학습 목표 AD Converter AD Converter Register 2.
Pointers Example Use int main() { int *x; int y; int z; y = 10; x = &y; y = 11; *x = 12; z = 15; x = &z; *x = 5; z = 8; printf(“%d %d %d\n”, *x, y, z);
ASPPRATECH.
Lecture 9 Timer Operations and Programming. 2  Introduction  Summary of timers  Timer programming sequence  Summary of timer SFRs  Timer 0: 8-bit.
UART Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 UART Init UART Send UART Receive UART -> Debugging Console Up/Down Game 제작 2.
Pulse Width Modulation
Basic Stamp Free Pins These pins can be used by the operator for digital Inputs and Outputs Used Pins 0.
ELE2MIC Lecture 21 The AVR Sleep Modes ATMEGA128’s Analog to Digital Converter –Features –Block Diagram –Clock Source –Input Sources –Interrupts –BandGap.
Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6.
UART: Universal Asynchronous RX/TX
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
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.
Lecture 11: TI MSP430 Timers Compare Modes
PWM UNIT 17 로봇 SW 교육원 조용수. 학습 목표 PWM PWM Register 2.
Robotics Research Laboratory Louisiana State University.
로봇을 조종하자 3/4 UNIT 17 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 스마트 폰의 센서를 사용할 수 있다. 2.
1 LHO 13 The 8051CF020 and the University Daughter Card.
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.
Renesas Electronics Corporation © 2010 Renesas Electronics America Inc. All rights reserved. RX 12 Bit Analog-to-Digital Converter A Rev /1/10.
로봇 모니터링 1/2 UNIT 20 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Message Queue Handler 2.
The Silicon Laboratories C8051F020
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.
By James Cockrell and Justin Loveless
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
Chapter 5 - Interrupts.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
PWM Test 2 UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Servo 제어 2.
Analog to Digital Converter (ADC)
System Control & Clock UNIT 08 로봇 SW 교육원 조용수. 학습 목표 System Control Register System Clock CMSIS CMSIS Project 2.
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
Timer & Watch Dog Test UNIT 16 로봇 SW 교육원 조용수. 학습 목표 Timer Init Timer Delay Test Timer Interrupt Test –One Shot Mode –Periodic Mode Watch Dog Test 시계 만들어.
Temperature Sensor TYWu. Seeed’s Temperature Sensor Picture.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
Sensing Algorithm using IR Sensor and ADC Soong-sil University. Robotics 기 정 두 원.
WEATHER MONITORING SYSTEM. User Requirements  Design a weather monitoring system that detects the following parameters  Temperature  Pressure  Relative.
By: Shivanshi pandya(30) Ayushi chourasia (3) Pranavi chhikniwala(6)
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
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.
Application Case Study Christmas Lights Controller
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
Multifunctional Sensor
Cortex-M0 MCU Clocks & Pins
Analog-to-Digital Converter (ADC)
Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)
ESP8266 Tutorial (Web server)
Table 2. Microcontroller pin description[5]
Prof. Chung-Ta King Department of Computer Science
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
8051 Micro Controller.
Device Drivers – Digital Voltmeter
Prof. Chung-Ta King Department of Computer Science
UNIT 26 SPI Test 로봇 SW 교육원 조용수.
A modular robot for use in the RoboSumo lab
Presentation transcript:

UNIT 20 AD Converter Test 로봇 SW 교육원 조용수

학습 목표 조도 센서 값 읽기 가변 저항 값 읽기 가변 저항 값 읽어서 LED에 적용

조도 센서 값 읽기 APDS-9007 : Ambient Light Photo Sensor with Logarithmic Current Output

ADC Init void SYS_Init(void) { /* Unlock protected registers */ SYS_UnlockReg(); /* Enable IP clock */ CLK->APBCLK |= CLK_APBCLK_UART0_EN_Msk; CLK->APBCLK |= CLK_APBCLK_ADC_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; /* Set P1.0 to AIN0 function */ SYS->P1_MFP = SYS_MFP_P10_AIN0 ; /* Lock protected registers */ SYS_LockReg(); }

ADC Init ADC Channel 0 Settings void ADC_Init() { ADC->ADCR &= ~(0x2 << 2); // Sing Mode ADC->ADCR |= 0x1 ; // ADEN Set }

ADC Init Read ADC Channel 0 int value0 = 0; ADC->ADCHER = (0x1 << 0) ; // ADC Channel 0 Set ADC->ADCR |= 0x1 << 11 ; // Start Convert while(ADC->ADSR & (0x1 << 3)); value0 = ADC->ADDR[0] & 0xFFFF; printf("Photo Sensor Value 11 : "); printf("%d \n", value0);

ADC Init Set Interrupt Handler void ADC_IRQHandler() { int value0 = 0; NVIC->ICPR[0] = (0x1 << 29); ADC->ADSR &= ~0x1; // Clear Interrupt ADC->ADCR &= ~(0x1 <<1) ; // Disable Interrupt value0 = ADC->ADDR[0] & 0xFFFF; printf("ADC(Interrupt) : "); printf("%d \n", value0); }

ADC Init Start ADC using Interrupt Int main() { … //NVIC_EnableIRQ(ADC_IRQn); NVIC->ISER[0] = (0x1 << 29); printf("Stat ADC\n"); ADC->ADCHER = 0x1 ; // ADC Channel 0 Set ADC->ADCR |= (0x1 <<1) ; // Enable Interrupt ADC->ADCR |= 0x1 << 11 ; // Start Convert }

가변 저항 값 읽기 VCC , GND , ADC1 연결

가변 저항 값 읽기 ADC 0, 1 선택 void SYS_Init(void) { /* Unlock protected registers */ SYS_UnlockReg(); … /* Set P1.0 to AIN0 function */ SYS->P1_MFP = SYS_MFP_P10_AIN0 | SYS_MFP_P11_AIN1; /* Lock protected registers */ SYS_LockReg(); }

가변 저항 값 읽기 ADC 0, 1 선택 void ADC_IRQHandler() { int value0 = 0; NVIC->ICPR[0] = (0x1 << 29); ADC->ADSR &= ~0x1; // Clear Interrupt ADC->ADCR &= ~(0x1 <<1) ; // Disable Interrupt value0 = ADC->ADDR[0] & 0xFFFF; value1 = ADC->ADDR[1] & 0xFFFF; printf("ADC(Interrupt) : "); printf("%d , %d\n", value0, value1); }

가변 저항 값 읽기 ADC 0, 1 선택 printf("Stat ADC\n"); ADC->ADCHER = (0x3 << 0) ; // ADC Channel 0,1 Set ADC->ADCR |= (0x1 <<1) ; // Enable Interrupt ADC->ADCR |= 0x1 << 11 ; // Start Convert

가변 저항 값 읽기 Single Cycle Scan Mode void ADC_Init() { ADC->ADCR &= ~(0x2 << 2); // Sing Mode ADC->ADCR |= 0x2; // Single Cycle Scan Mode ADC->ADCR |= 0x1 ; // ADEN Set }

가변 저항 값 읽어서 LED에 적용 가변 저항 값 읽어서 구간 별로 4개의 LED On 0 ~ 10 : All OFF