INTRODUCTION
Dr. Tran Thanh Hung Department of Automation Technology, College of Engineering, Can Tho University Email: tthung@ctu.edu.vn
Outline
Seminar objectives
Seminar objectives
At the end of this seminar, by referring the lecture notes, students will be able to: know the course objectives identify the requirements for an embedded system explain why 8051 and C are chosen for embedded system development explain the relationship between C, assembly, and machine languages know the basic features of AT89S52 write a simple software to run a task
Applications of embedded system Mobile phone systems Automotive applications Domestic appliances
Aerospace applications
Medical equipment
Defence systems
Course overview
This course will introduce the principles of programming embedded system. By the end of this course, you will be able to: Know how to build an embedded system Design embedded software for a simple application Implement and test designed software Understand issues of reliability and safety
Textbooks
1. Embedded C by Michael J. Pont 2. AT89S52 datasheet
Why C?
A mid-level: - support functions - access hardware Independent to device High efficient Popular Easy to understand Good compilers
Why 8051?
How to chose MCU for an embedded system? Some famous MCUs:
+ Z80 (8bit) designed by Zilog from1976: needs too many clock periods to run an instruction + 8051 (8bit) series (or MSC-51) developed by Intel from1980: one of the first single chip microcontrollers, needs 12 clock periods to run an instruction + AVR (8bit-RISC) developed by Atmel in 1996, integrates ADC and many other components, most instructions run in 1 clock period
Why 8051?
In this course, 8051 family is chosen, because: - Price: very cheap - Available: very famous, easy to find - Performance: suitable for many embedded systems - Wide range: many MCUs to chose
See http://www.atmel.com/dyn/products/datasheets.asp?family_id=604
AT89S52
Low-voltage, high-performance microcontroller:
32 programmable I/O lines (in 4 ports) 8K Bytes of In-System Programmable (ISP) Flash Memory (10,000 Write/Erase Cycles ) 256 x 8-bit Internal RAM
AT89S52
Three 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Watchdog Timer
Software delay
How to create a delay without using any hardware resource ?
void loop_delay(void) { unsigned int x; for (x = 0; x <65535; x++); } void longer_loop_delay(void) { unsigned int x, y; for (x = 0; x <65535; x++) { for (y = 0; y <65535; y++); } }
Software delay
What are strengths of software delay ?
- Can be used to create very sort delays - Require no hardware - Will work on any microcontroller
Conclusion
Seminar objectives
Exercise 1.1
1. 2. 3. 4. 5. 6. 7. 8. 9. Run Keil C Create a new project Type the program in example 2 Build the project Start debugging Click Run Chose PeripheralI/O-PortsPort1, Port2 Change Port1 pins, observe Port2 Toggle disassembler window, find out the relationship between instructions in C, assembly and machine languages
Test 1.1
1. List of components needed to build a core of an embedded system. 2. Why 8051 and C are chosen for embedded system development?