從零開始,學習嵌入式系統
嵌入式系統是嵌入式計算機系統的簡稱。顧名思義,它是一種嵌入在設備/系統內部,為特定應用而設計開發的專用計算機系統。英國電力工程師協會(Institution of Electrical Engineers,IEEE)從應用的角度定義嵌入式系統是「控制、監視或協助設備、機器、工廠運行的裝置」(devices used to control, monitor, or assist the operation of equipment machinery or plants)。
嵌入式系統與具體應用緊密結合,具有很強的專用性。它按照特定的應用需求進行設計,完成預定的任務。正因為目標明確,所以嵌入式系統往往能做到最優化的設計和剪裁。因此其運行效率一般很高。
嵌入式系統廣泛用於過程控制、數據擷取、通訊傳輸等領域,承擔著測量、控制、調節、報警等要求及時作出反應的任務。因而嵌入式系統一般都有一定的即時性,即:必須在一個可預測和有保證的時間段內對外部事件作出正確反應。
使用 Basys MX3 進行嵌入式系統教學
由 Greg Mason 博士在 2018 年 ASEE 會議上提供的免費教案,使用 Digilent Basys MX3 進行嵌入式系統教學,內涵包括 7 個深入的教學單元與 15 個完整的實驗材料
The goal for this series of laboratory designs is to teach not only how to manage the PIC32 processor to solve engineering design problems, but also how to produce dependable (validated) and sustainable (verified) software using best design practices. To that end, Unit 1 will begin by introducing engineering concepts that are important in developing these best practices. Although some of these concepts may seem trivial at first, they are important in measuring the ability of a system to meet design requirements and specifications, and will be implemented throughout Units 1-7.
單元 1:微處理器
Microprocessor I/OHow to develop a plan for a software-based microprocessor design. Understand the management of basic microprocessor digital inputs and outputs. Write an application that utilizes the Basys MX3 processor platform to perform basic calculator functions and display the results on a 4-digit 7-segment LED display. Become familiar with the circuits included on the Basys MX3 PCB.
單元 2:即時系統的要素
Elements of Real-time SystemsThe objectives: to implement task management based on polling PIC32 timers; to implement task management based on PIC32 timer interrupts.; to understand the principles of a software implemented finite state machine (FSM); to use time management and FSM code to control the speed of rotation of the stepper motor rotor; to implement a multitasking real-time application using foreground-background scheduling.
單元 3:用於 LCD 控制的並行 I/O
Parallel I/O and Handshaking for LCD ControlThe objectives: to identify the PIC32 processor pins used for the LCD interface; to write a library of functions, providing the general capability to display strings of text, characters, and numbers at specified positions on the LCD display. All of these functions have strict timing requirements; to display static and dynamic text on the LCD; to verify that the timing of the handshaking meets the specified minimums; to understand handshaking requirements for interfacing two systems operating at differing clock speeds.
單元 4:通訊-串行協議/ 異步串行協議
Communications - Serial Protocol/ Asynchronous Serial ProtocolsUnit 4 consists two parts and four labs. Unit 4 Part 1 contains the following overview that addresses different high level views of digital communications. Unit 4 Part 2 addresses asynchronous communications protocols, specifically the Universal Asynchronous Receiver Transmitter (UART) protocol, and applies specifically to Lab 4a and Lab 4b. Lab 4a focuses on full-duplex text communications and Lab 4b uses the communications for control of a real-time operating system. Lab 4c and Lab 4d look at two commonly used synchronous data communications protocols. Lab 4c targets the Serial Peripheral Interface (SPI) protocol while Lab 4d focuses on the Inter-Integrated Circuit (I2C) protocol.
單元 5:IrDA通訊協議
IrDA Communications ProtocolsThis unit demonstrates how to use interrupts and the core timer to decode two IrDA protocols, in an effort to teach approaches for decoding different IrDA protocols used for remote device control. The IrDA is an implementation of wireless serial communications capable of simplex as well as half-duplex operation. I have encountered no fewer than 100 IrDA encoding protocols using pulse modulated infrared beams of light. Of the four IR remote control units I have found around my home, no two use the same encoding scheme. With so many existing IrDA protocols used for remote control devices, I present a method for decoding and encoding the NEC protocol that can be used on different schemes. I have verified this methodology for decoding the Pulse Length (also called Pulse Distance Modulated) protocol. Lab 5 will challenge you to follow the methodology presented to develop an interface for an IrDA remote control device of your own choosing. Some silicon devices will decode NED encoded IrDA to 9600 Baud UART outputs, such as the ST3679. Other silicon devices will alleviate the burden of pulse encoding and decoding, such as the Microchip MCP2122, which allows direct interface with the processor UART. The above two IrDA hardware devices are designed to implement wireless line-of-sight asynchronous communications and do not interface with NEC IR remote control devices.
單元 6:模擬 I/O和過程控制
Analog I/O and Process ControlThe purpose of this laboratory exercise is to investigate applications of embedded controllers to real time control algorithms that employ analog inputs and analog outputs. You will use a computer algorithm to implement a closed-loop processor fro motor speed control. You will see how feedback can be used to linearize an inherently nonlinear process and result in zero steady state control error.
Objectives: to generate PWM outputs to implement variable motor supply voltage; to implement a tachometer operation using PIC32 Timers;to develop MPLAB X projects that implement open-loop and closed-loop motor control; to develop the C program code to implement a PI controller and a moving average digital filter; to manage multiple background tasks in an interrupt driven system; to monitor and display data from a process running in real-time.
單元 7:音頻訊號處理
Audio Signal ProcessingThis unit focuses on processing signals in the audio frequency range using digital signal processing (DSP) concepts with the PIC32MX370 microprocessor. Lab 7a investigates a method of generating multiple frequency signals without using transcendental functions or lookup tables. Lab 7b uses Discrete Fourier Transforms (DFT) to detect the presence of signals. It is not the purpose of this unit to teach the theory of digital filtering, but rather to teach how to implement digital filtering using a conventional microprocessor in lieu of specialized digital signal processors.
The objectives: to extend the applications of digital signal processing introduced in Unit 6; to use a DSP algorithm to synthesize sine waves; to use a DSP algorithm to analyze a periodic signal using Discrete Fourier Transforms; how to implement DSP algorithms on the PIC32 processor using C; how to use the PIC32 MIPS DSP library to increase the DSP algorithm execution speed.