TAILIEUCHUNG - Lập trình C bằng tiếng Anh phần 2

This chapter gives a basic overview of programming in C for an embedded system. We will introduce some basic terms so that you get a basic feel for the language. Since this is just the first of many chapters it is not important yet that you understand fully the example programs. The examples are included to illustrate particular features of the language. | Chapter 1 Program Structure -- Valvano Page 1 of 15 Chapter 1 Program Structure What s in Chapter 1 A sample program introduces C C is a free field language Precedence of the operator determines the order of operation Comments are used to document the software Prepreocessor directives are special operations that occur first Global declarations provide modular building blocks Declarations are the basic operations Function declarations allow for one routine to call another Compound statements are the more complex operations Global variables are permanent and can be shared Local variables are temporary and are private Source files make it easier to maintain large projects This chapter gives a basic overview of programming in C for an embedded system. We will introduce some basic terms so that you get a basic feel for the language. Since this is just the first of many chapters it is not important yet that you understand fully the example programs. The examples are included to illustrate particular features of the language. Case Study 1 Microcomputer-Based Lock To illustrate the software development process we will implement a simple digital lock. The lock system has 7 toggle switches and a solenoid as shown in the following figure. If the 7-bit binary pattern on Port A bits 6-0 becomes 0100011 for at least 10 ms then the solenoid will activate. The 10 ms delay will compensate for the switch bounce. For information on switches and solenoids see Chapter 8 of Embedded Microcomputer Systems Real Time Interfacing by Jonathan W. Valvano. For now what we need to understand is that Port A bits 6-0 are input signals to the computer and Port A bit 7 is an output signal. Before we write C code we need to develop a software plan. Software development is an iterative process. Even though we list steps the development process in a 1 2 3. order in reality we iterative these steps over and over. 1 We begin with a list of the inputs and outputs. We specify the range of values and their

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.