Presentation is loading. Please wait.

Presentation is loading. Please wait.

Robotics Research Laboratory Louisiana State University.

Similar presentations


Presentation on theme: "Robotics Research Laboratory Louisiana State University."— Presentation transcript:

1 Robotics Research Laboratory Louisiana State University

2  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 COL1COL2 COL3 ROW1 ROW2 ROW3 ROW1 ROW2 ROW3 COL1 COL2COL3

4 COL1COL2 COL3 ROW1 ROW2 ROW3 ONOFF ON COL1COL2 COL3 ROW1 ROW2 ROW3 OFFON OFF ON OFF ON COL1COL2 COL3 ROW1 ROW2 ROW3 OFF ON OFF 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9

5  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  64 LEDs

7  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  Tic-Tac noise  Siren  Sound pitch control  Play Song

9  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 DDRx Register01101100 PORTxIn out In out In Controls I/O status

11 PORTx Register01101100 PORTx out Controls I/O status DDRx Register11111111 offon offon off Binary : 0b01101100 Hex: 0x6C Decimal: 76

12 PORTx Register01101100 PORTx in Controls DDRx Register00000000 vcc Pull-up for input 0x00 0x6C

13 PORTx Register11111111 PORTx in Controls DDRx Register00000000 vcc PINx Register01101100 Reads - + + - + + - - 0x6C 0xFF 0x00

14 PORTD PORTB PORTE PORTG PORTF PORTA PORTC

15  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 65473210 DDRA: 0x0F in in in in out out out out PINA : 0x36 (48) - + -- - + ++ LED4 LED2 LED1 Button4 Button3 Button1 Button2 Button 1,2 : Released, Button 3, 4 : Pressed LED 1,4 : OFF, LED 3,4 : ON PIN 0 ~ 3 : Output (LED), PIN 4 ~ 7 : Input (Button) PORTA: 0xF6 1 1 1 1 0 1 1 0 Pull-up for input PIN1,2 are high(on) PIN 0,4 are low(off) 0 0 1 1 0 1 1 0 GND

17 Hexa-decimalBinaryDecimal 0x00b00000 0x10b00011 0x20b00102 0x30b00113 0x40b01004 0x50b01015 0x60b01106 0x70b01117 0x80b10008 0x90b10019 0xA0b101010 0xB0b101111 0xC0b110012 0xD0b110113 0xE0b111014 0xF0b111115 0x6C0b0110 1100108

18 ◦ 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( > ) : 1 << 3  00001000 (=8) ◦ 40 >> 1  00101000 >> 1  00010100 (=20) 40 >> 5  00000001 (=1)

19  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  /home/csc2700/csc27000/08-button-led- 3x3-01

21  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  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


Download ppt "Robotics Research Laboratory Louisiana State University."

Similar presentations


Ads by Google