Robotics Research Laboratory Louisiana State University.

Slides:



Advertisements
Similar presentations
MICROPROCESSORS AND MICROCONTROLLERS
Advertisements

EMS1EP Lecture 8 Pulse Width Modulation (PWM)
More fun with Timer/Counters
Indian Institute of Technology Hyderabad ROBOTICS LINE FOLLOWER HARI KISHAN TANDEY – ES12B1008 DILIP KONDAPARTHI – ES12B1010 SAI KARTIK – CE12B1015.
MICRO-CONTROLLER: A microcontroller is the brain of the robot: These are: 1. Integrated Circuits (ICs) 2. Programmable.
Robotics Research Laboratory Louisiana State University.
Programming Microcontrollers B. Furman 19MAR2011.
Robotics Research Laboratory Louisiana State University.
Potentiometer Electric circuit Cell or Battery Resistor Switch Bulb Earth/Ground LED.
Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
Programming the ATmega16
Robotics Research Laboratory Louisiana State University.
An Embedded C Program 1 Mainly from textbook: Embedded C Programming and the Atmel AVR 2 nd Edition Barnett, Cox and O’Cull.
Robotics Research Laboratory Louisiana State University.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Robotics Research Laboratory Louisiana State University.
Robotics Research Laboratory Louisiana State University.
The Use of Microcontrollers
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
 C is general-purpose structured programming language or high level language.  It was developed by Dennis Ritchie in 1970s at Bell laboratories. 
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
Robotics Research Laboratory Louisiana State University.
Robotics Research Laboratory Louisiana State University.
Robotics Research Laboratory Louisiana State University.
Advanced uC Session Speaker : Chiraag Juvekar Jan 13, 2011 Speaker : Chiraag Juvekar Jan 13, 2011.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
AVR Programming: Digital I/O September 10, What is Digital I/O? Digital – A 1 or 0 Input – Data (a voltage) that the microcontroller is reading.
Digital Inputs Interfacing Keypad
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
DsPIC30F4011 Fall DIP Switches  The upper four switches of SW1 are used to enable LEDs connected to PORTB/C, PORTA/D, PORTE and PORTF. For example,
EMBEDDED SYSTEM & ROBOTICS. Introduction to robotics Robots are machines capable of carrying out a complex series of actions automatically. Robotics is.
Microcontrollers, Microcomputers, and Microprocessors
UNIT 7 - INTRODUCTION TO I/O INTERFACING. TWO MAJOR TYPES OF I/O INTERFACING ISOLATED I/O - DEDICATED I/O INSTRUCTIONS ARE USED TO ACCESS I/O DEVICES.
Arduino Mega Arduino Mega 2560 Arduino Mega 2560.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
Embedded Systems Lecture 4 January 20, 2016.
Embedded systems and sensors 1 Part 2 Interaction technology Lennart Herlaar.
MICROCONTROLLER INTERFACING WITH STEPPER MOTOR MADE BY: Pruthvirajsinh Jadeja ( ) COLLEGE:DIET BRANCH:EC.
Microcontroller basics Embedded systems for mortals.
Introduction to AVR Name : 1) Abhishek Yadav ) Prakash Giri ) Kheni Niral ) Bhadresh Langadiya Branch.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
WHY PARALLEL PORT? The simplest computer controlled robot Requires only basic programming skills in C to start off with Can take inputs from your robot.
Microprocessors A practical approach..
INTERFACING HARDWARE WITH MICROCONTROLLER GUIDED BY: Prof. ASIF SIR 1. AKSHAY KIRAN 2. DEEP PARIKH 3. JIGAR PATEL 4. TILAK PATEL ,05,D2D06,09.
16-Bit Timer/Counter 1 and 3
Servos Elementary Robotics with Servos
Outline Introduction to Arduino UNO Programming environment setup GPIO
Val Manes Department of Math & Computer Science
Microcontroller basics
COMP2121: Microprocessors and Interfacing
Arduino Part 1 Topics: Microcontrollers Programming Basics
The Arduino Microcontroller: Atmel AVR Atmega 328
Session 3,4.
Timer/Counter Modified from Dr. Lam Phung’s Slides.
16-bit Timer/Counter1 Features
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
IoT Programming the Particle Photon.
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Decoding and Using a 4x4 Keyboard
Wave Generation and Input Capturing
Decoding and Using a 4x4 Keyboard
Presentation transcript:

Robotics Research Laboratory Louisiana State University

 What is the definition of a robot for computer scientist?  Give an example for a robot in common household and why  Give an example for not a robot in common household and why * * * * Mark are example questions for midterm

 AVR-C : variable type  AVR-C : condition/Loop uint8_t: 1 Byte  0 ~ 255 uint16_t: 2 Bytes  0 ~ uint32_t: 4 Bytes  0 ~ char: 1 Byte int: 2 Byte  ~ double: 4 Bytes float: 4 Bytes *: pointer char[], int[], double[], … : Array, also multi- dimensional array if ( ) {} if ( ) {} else {} switch () { case: … case: … … } for ( ; ; ) { } while ( ) { } do { } while () What is size of uint8_t? What is value range of uint8_t? * *

 AVR-C : basic structure #include  a library provided by avrc-compiler #include “yourLibrary.h”  your library void yourFuctions(void);  Declare prototype functions first int main(){  main of the program InitHardware();  initialize hardware while(1) {  One main while loop yourFunction();  call the declared function } void yourFuction(void){}  functions What does InitHardware do? Who is providing #include liblary ? * * How to provide your library *

 LED (Light Emitting Diode)  3x3 LED matrix + - COL3 ROW1 ROW2 ROW3 OFFON OFF ON OFF ON COL1COL2 What happen in LED with below connection? * * + - What combination of outputs on cols/rows can make only led5 ON? What happen in LED with below connection? * + - LED ON What happen in LED with below connection? + + *

 PORT: collection of pins for communication between microprocessor and other devices  PORT control register ◦ PINx : to read the values of the pins in PORTx,  pins:  if (PINx == 0x31)... ◦ PORTx : to assign v alues to the pins in PORTx, PORTx = 0x31  PINx = 0x31  is meaningless ◦ DDRx : Controls the Input/Output specification of pins in PORTx ( 0  intput, 1  output) What is PORT? What is DDRx? * * What is PINx? * What is PORTx? *

DDRA: 0x0F in in in in out out out out PINA : 0x36 (48) LED4 LED3 LED2 LED1 Button4 Button3 Button1 Button2 Button 1,2 : Released, Button 3, 4 : Pressed LED 1,4 : OFF, LED 2,3 : ON PIN 0 ~ 3 : Output (LED), PIN 4 ~ 7 : Input (Button) PORTA: 0xF Pull-up for input by Microcontroller PIN1,2 are high(on) PIN 0,4 are low(off) GND Pull-down PINA6,7 by Button3,4 pressed What is value of PINA If putton3,4 are pressed? * What is value of PORTA for only LED2,3 ON? * What is value of DDRA for (Output:pin0 ~ 3) (input: pin 4 ~ 7) ? *

 PWM control ICR3 = 40000u;// input capture register TCNT3 = 0;// interrupt flag register // Set the WGM mode & prescalar TCCR3A = ( 1 << WGM31 ) | ( 0 << WGM30 ) |// timer control register ( 1 << COM3A1 ) | ( 1 << COM3B1 ) | ( 1 << COM3C1 ); TCCR3B = ( 1 << WGM33 ) | ( 1 << WGM32 ) | // timer control register TIMER3_CLOCK_SEL_DIV_8; DDRE |= (( 1 << 3 ) | ( 1 << 4 ) | ( 1 << 5 ));// I/O control register uint16_t count = 0; while (1){ OCR3A = count++;// 0 ~ (pulse width), PINE3 us_spin(200); } PWM initialization What does it mean? * What does it happen when the value of count increase? *

 MOSFET based H-bridge DC-Motor controller #define MOTOR_IN1_PIN 0 #define MOTOR_IN1_MASK (1 << MOTOR_IN1_PIN) #define MOTOR_IN1_DDRDDRF #define MOTOR_IN1_PORTPORTF #define MOTOR_IN2_PIN 1 #define MOTOR_IN2_MASK (1 << MOTOR_IN2_PIN) #define MOTOR_IN2_DDRDDRF #define MOTOR_IN2_PORTPORTF #define MOTOR_STANBY_PIN 1 #define MOTOR_STANBY_MASK (1 << MOTOR_STANBY_PIN) #define MOTOR_STANBY_DDRDDRF #define MOTOR_STANBY_PORTPORTF #define MOTOR_PWMOCR3A pwm_init();  PWM initialization DDRF = 0xFF  all pins in PORTF are outputs PORTF = 0x00  pull down for all outputs MOTOR_PWM = 10000;  pwm signal is MOTOR_STANBY_PORT |= MOTOR_STANBY_MASK;  STBY : high MOTOR_STANBY_PORT |= (MOTOR_IN1_MASK | MOTOR_IN1_MASK );  IN1 : high, IN2 : high (Short brake) MOTOR_STANBY_PORT &= ~ (MOTOR_IN1_MASK | MOTOR_IN1_MASK );  IN1 : low, IN2 : low (Short brake) MOTOR_STANBY_PORT |= MOTOR_IN1_MASK; MOTOR_STANBY_PORT &= ~MOTOR_IN1_MASK;  IN1 : high, IN2 : low (CCW) MOTOR_STANBY_PORT &= ~MOTOR_IN1_MASK; MOTOR_STANBY_PORT |= MOTOR_IN1_MASK;  IN1 : low, IN2 : high (CW) What does it happen in Motor? * What does it happen in Motor when the number is increased? *