1 / 22

Lecture 7 7-Segment LED controller using u-controller

Lecture 7 7-Segment LED controller using u-controller. 2007/11/02 Prof. C.M. Kyung. Experimental Goal. GOAL is to get familiar with.. Intel 8051 microcontroller The concept of interrupt & timer/counter COMPACT51 experimental board for 8051 KEIL uVisionII. Introduction.

manchu
Download Presentation

Lecture 7 7-Segment LED controller using u-controller

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. Lecture 7 7-Segment LED controller using u-controller 2007/11/02 Prof. C.M. Kyung

  2. Experimental Goal • GOAL is to get familiar with.. • Intel 8051 microcontroller • The concept of interrupt & timer/counter • COMPACT51 experimental board for 8051 • KEIL uVisionII

  3. Introduction • About Microcontroller • Embedded computer로 소형이면서 단독기기 제어에 적합하다 • CPU(Microprocessor) + Memory Unit + I/O Unit + Interface 기능 • Single chip으로 다양하고 고성능의 기능을 얻을 수 있다 • 산업용 제어분야, 계측기기, 가전제품, OA용 기기, 자동차 등 많은 분야에서 활용된다.

  4. Microcontroller • Intel 8051 • 제어 목적에 적합하도록 설계된 8bit Microcontroller • 111종류의 instruction이 있고, 64종은 one clock에 실행된다. • 64KB external program memory, 64KB external data memory • 128byteinternal data RAM, 4KB internal program ROM • System Clock을 위한 오실레이터 회로 내장 • 2개의 16bit Timer/Counter, 1개의 UART • 6 Interrupt source

  5. Intel 8051 • Chip / External Port

  6. Intel 8051 • Architecture • CPU core – PC, ALU • 128byte Data RAM • 4KB Program ROM • I/O Controller • 2 Timer, 1 Uart • SFR (Special Function Register)

  7. Intel 8051 • SFR – Special Function Register • Internal Data Memory 중 0x80 ~ 0xFF의 구역 • PSW (Program Status Word) – 프로그램 실행중의 상태를 나타내고, cpu의 기능을 제어하는 Register • SP (Stack Pointer) – 현재 Function의 stack 주소를 나타냄 • Interrupt 제어 Register들 – IE,IP,IPH • Timer, UART, 등의 peripheral control Register들 – TMOD, TCON

  8. Intel 8051 • Interrupt • Interrupt는 processor의 수행 순서를 제어하는 일반적인 방법이다. • 대부분의 I/O device는 processor보다 느리므로 processor가 이를 기다려야 하는 문제를 Interrupt를 이용하여 처리한다. • Interrupt가 발생하면 processor는 하던 일을 중지하고 Interrupt가 요청한 일을 하고 그 후에 원래 하던 일로 돌아가게 된다. • ISR (Interrupt Service Routine) – Interrupt 발생 시, processor가 해야하는 일 • 여러 개의 Interrupt source가 있을 경우, 각 interrupt는 priority(우선순위)를 가진다.

  9. Intel 8051 • Interrupt • Interrupt에 의한 control flow의 변화

  10. Intel 8051 • Interrupt • 8051은 6개의 Interrupt source를 가지고 있다. • Interrupt Vector는 해당 interrupt가 발생했을 때, 처리해야 하는 ISR의 시작 주소이다. Processor는 이 주소로 Jump하게 된다.

  11. Intel 8051 • Timer / Counter • Count the machine cycle (1/12 of internal system cycle) or external clock / event • When the 8bit or 16bit timer overflows, timer interrupt occurs • 8051 has 2 timers – Timer0, Timer1 • Timers are controlled by TMOD, TCON registers • 4 modes are available

  12. Intel 8051 • Timer / Counter Example • To generate timer interrupt at 1ms • System clock = 11.0592MHz  system clock / 12 = 0.9216MHz, 1ms ≒ 922 counts • Use 16bit timer  interrupt occurs at 65536 • Set the timer to use internal clock & initialize to (65536 - 922) = 64614

  13. KEIL uVisionII • IDE (Integrated Development Environment) for 8051 Microcontroller • Program edit • Compile • Download to COMPACT51 board with UART • Debug at the board • Simulation & debugging at the PC are also available • Refer to the handout for detailed instructions

  14. Problem Statement (1) • 7-segment control • 스톱워치를 제작한다. • INT0 버튼을 누르면 타이머가 시작하고 다시 INT0 버튼을 누르면 타이머가 정지한다. TIMER0 버튼을 누르면 타이머가 clear된다.(0.00이 된다.) • 시간은 세 개의 7 segment logic을 통해 보여준다. 처음 10초 동안은 왼쪽 한 개가 초 단위를 나타내고 가운데 것이 1/10초, 오른쪽 것이 1/100 초 단위의 시간을 보여준다. 이때 왼쪽 한 개와 오른쪽 두 개 사이, 즉 1초와 0.1초 사이에는 소수점을 찍는다. • 10초가 넘어가는 순간 왼쪽 두 개는 초 단위의 시간을, 오른쪽 한 개는 0.1초 단위의 시간을 나타내는 것으로 바뀌고 둘 사이에는 소수점을 찍는다. 즉 소수점의 위치가 한 칸 오른쪽으로 이동하며 1/100초를 나타내는 자릿수의 숫자는 사라지게 된다. (즉 Resolution이 줄어들고 scale이 커지는 것이다. ) 이렇게 해서 총 99.9초까지의 시간을 표시할 수 있게 된다.

  15. Problem Statement (1)

  16. COMPACT51 Board Block Diagram

  17. 82C55 • Programmable Peripheral Interface chip • In this experiment, 3 ports are connected to 7-segment logics • To control 7-segment logics, set the ports ‘output’ and write appropriate values to the ports

  18. 7-Segment Logic Controller • Each segment with ‘high’ signal is turned on • ‘a’ is connected to bit 0, ‘b’ is connected to bit 1, etc. • To display ‘2’, write ‘01011011’ to Port A of 8255

  19. Problem Statement (2) • LED control • 스톱워치가 동작하는 동안 1초마다 일렬로 나열된 8개의 LED 가 순차적으로 켜지게 된다. 즉 한 개의 LED를 넘어가는 시간은 0.125초가 된다. • N 번째의 LED가 켜지는 순간에도 N-1 번째의 LED 는 켜진 채 유지되어야 한다. • 8번째까지 불이 켜지면(즉 8개 전부 불이 켜진 상태) 그 다음은 첫 번째 LED 부터 차례로 불이 꺼진다. 역시 1초 동안 8개의 LED가 각각 0.125초 마다 차례로 꺼지게 되며 N번째 LED가 꺼지는 순간에도 N-1 번째의 LED 는 꺼짐을 유지한다. • 위의 동작이 2초를 주기로 반복되게 한다.

  20. LED Controller • Each LED with ‘low’ signal is turned on

  21. Experiment Requirements • COMPACT51 board • PC • KEIL uVisionII program • UART cable • http://blog.naver.com/ykb4027?Redirect=Log&logNo=150022494602

  22. References & Contact • Textbook • 8051 user’s manual • 8255 user’s manual • 8051 & C Programming, 문왕환, 도서출판 세화 • 7th Week T.A. E-mail seeseah@eeinfo.kaist.ac.kr seungjin@eeinfo.kaist.ac.kr jeabin@eeinfo.kaist.ac.kr • Lecture Homepage http://wink.kaist.ac.kr/course/ee306/

More Related