1 / 22

CSC-2700 – (3) Introduction to Robotics

CSC-2700 – (3) Introduction to Robotics. Robotics Research Laboratory Louisiana State University. What we learned in last class. Diode Zener diode, Avalanche diodes, Photodiode diode Light Emitting Diode Digital Out – pin out control LED ON LED OFF LED TOGGLE LED Matrix

malise
Download Presentation

CSC-2700 – (3) Introduction to Robotics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC-2700 – (3) Introduction to Robotics Robotics Research Laboratory Louisiana State University

  2. What we learned in last class • Diode • Zener diode, Avalanche diodes,Photodiode diode • Light Emitting Diode • Digital Out – pin out control • LED ON • LED OFF • LED TOGGLE • LED Matrix • 3*3 LED matrix • 5*7 LED matrix • 8*8 LED matrix

  3. Let make 3 * 3 LED matrix program COL1 COL2 COL3 COL1 COL2 COL3 ROW1 ROW1 ROW2 ROW2 ROW3 ROW3

  4. Make some patterns on LED matrix COL1 COL2 COL1 COL2 COL3 COL3 ON OFF OFF ON OFF OFF 2 ROW1 OFF 1 ROW1 ON 3 2 1 3 ROW2 ROW2 5 4 ON OFF 6 5 4 6 8 7 9 8 7 9 ROW3 ON ROW3 ON COL1 COL2 COL3 OFF OFF ON ROW1 ON 2 1 3 ROW2 5 ON 4 6 8 7 9 ROW3 OFF

  5. Topics for today • Digital Output • 8 * 8 LED matrix • Techniques for LEDs control on LED matrix • Buzzer (sound) • Basic I/O Operation – PORT • Digital input • Switch • Button • Toggle button (Flag)

  6. Digital out – 8*8 LED dot Matrix • 64 LEDs

  7. Techniques for LED control on LED matrix • 8 x 8 LED matrix • How many pins are needed for 8x8 LED matrix control? • One LED at each frame • How many frames are required for one picture? • What is maximum delay of one frame for one picture? (25 frames per second) • One Column or Row at each frame • How many frames are required for one picture? • What are different effects on LED?

  8. Buzzer - sound • Tic-Tac noise • Siren • Sound pitch control • Play Song

  9. Basic I/O Operation - PORT • Port Control Registers PORT Control Registers (A ~ G) DDRx Controls the I/O status of the PORT pins PORTx Controls the output status of pins PINx Reads the Input status of pins

  10. Defining pins on PORT as either Input or Output DDRx Register 0 1 1 0 1 1 0 0 I/O status Controls PORTx In out out In out out In In

  11. Defining PORTx as output DDRx Register 1 1 1 1 1 1 1 1 PORTx Register 0 1 1 0 1 1 0 0 I/O status Controls PORTx out out out out out out out out Binary : 0b01101100 Hex: 0x6C Decimal: 76 off on on off on on off off

  12. Defining PORTx as Input DDRx Register 0x00 0 0 0 0 0 0 0 0 vcc PORTx Register 0 1 1 0 1 1 0 0 0x6C Controls PORTx in in in in in in in in Pull-up for input

  13. Read PORTx DDRx Register 0 0 0 0 0 0 0 0 0x00 vcc PORTx Register 1 1 1 1 1 1 1 1 0xFF Controls PORTx in in in in in in in in PINx Register 0 1 1 0 1 1 0 0 0x6C Reads Reads - + + - + + - -

  14. PORTx Configuration on a stamp board PORTE PORTG PORTB PORTF PORTD PORTA PORTC

  15. Digital input • PORT setting for input/output • Can be configured individually • Ex) PORTA = 0x00 // pins in PORTA are inputs PORTA = 0xFF // pins in PORTA are outputs PORTA = 0X0F // 0~3 pins are outputs // 4 ~7 pins are inputs PORTA = 0x08 // only pin3 is a output • Read PORT value (8bit) : 0 ~ 255

  16. Digital input PIN1,2 are high(on) PIN 0,4 are low(off) Pull-up for input PIN 0 ~ 3 : Output (LED), PIN 4 ~ 7 : Input (Button) DDRA: 0x0F in in in in out outoutout PORTA: 0xF6 1 1 1 1 0 1 1 0 6 7 5 4 3 2 1 0 0 0 1 1 0 1 1 0 PINA : 0x36 (48) - + + - - + + - Button2 Button4 LED4 LED2 Button3 Button1 LED2 LED1 GND Button 1,2 : Released, Button 3, 4 : Pressed LED 1,4 : OFF , LED 3,4 : ON

  17. 0x6C 0b0110 1100 108

  18. Bit operations • AND ( & ) : 0 & 0  0 0 & 1  0 1 & 0  0 1 & 1  1 • OR ( | ) : 0 | 0  0 0 | 1  1 1 | 0  1 1 | 1  1 • XOR (^) : 0 ^ 0  0 0 ^ 1  1 1 ^ 0  1 1 ^ 1  0 • Bit Shifts(<< or >> ) : 1 << 3  00001000 (=8) • 40 >> 1  00101000 >> 1  00010100 (=20) 40 >> 5  00000001 (=1)

  19. How to read only specific PIN on PORT • Ex) bitwise operations Let’s assume that we add 4 buttons on PINA4 ~ 7 and 4 LEDs on PINA0~3 LED0  PIN0, LED1  1, LED2  2, LED3  3 button0  PIN4, button1  PIN5, button2  PIN6, button3  PIN7 DDRA = 0x0F (0b00001111) : PINA0 ~3= output, PIN4~7 = input PORTA = 0xF0 (0b11110000) : pull up from PIN4 to 7 for input PINA = 0xF0 (0b11110000): initial status of PINA All LEDs are off, all buttons are released If LED2 is only need to be on  PORTA = PORTA | 0x04 ( 0b00000100 )  PINA == 0xF4 ( 0b11110100 ) Then, if only button2 is need to be read  PINA & 0x04 ( 0b01000000 ) Button2 released: PINA ( 0b11110100 ) & 0x40 ( 0b01000000 ) 0x40 (0b01000000)

  20. Let’s make a simple button program • /home/csc2700/csc27000/08-button-led-3x3-01

  21. Make a simple LED increment program • Make two buttons, a plus button and a minus button • Whenever the plus button is pushed, a number of LEDs turned on are increased all LEDs are on • Whenever the minus button is pushed, a number of LEDs turned on are decreased until all LEDs are off

  22. Homework-4 • Create an animation player which has two buttons, a play button and a selection button • Selection button is for selecting different LED animations ( at least three LED animations ) • Play button is for controlling stop/play selected LED animations

More Related