1、Explain the Hardware components of an embedded system in details.
Ans:Embedded hardware includes CPU, peripherals and external devices, among which, peripherals have I/O interface controller circuits, clock circuits, various types of buses, etc. External devices include RAM, ROM, flash memory, keyboard, LCD screens, etc.
Processor: Program Flow and data path Control Unit (CU) —includes a fetch unit for fetching instructions from the memory Execution Unit (EU) —includes circuits for arithmetic and logical unit(ALU), and for instructions for a program control task.The processor used in embedded systems can be of three types: Micro-Controllers , Microprocessors , Digital Signal Processor.
处理器:程序流和数据路径控制单元(CU)-包括从存储器执行单元(EU)获取指令的获取单元-包括用于算术和逻辑单元(ALU)的电路,以及用于程序控制任务的指令的电路。嵌入式系统中使用的处理器可以是三种类型:微控制器、微处理器,数字信号处理器。
Memory: The memory used in embedded systems can be either internal or external.It includes Random Access Memory , Read-Only Memory, Hybrid Memory.
内存:嵌入式系统中使用的内存可以是内部的,也可以是外部的。它包括随机存取内存、只读内存、混合内存。
Power Source: System own supply with separate supply rails for IOs, clock, basic processor and memory and analog units.
电源:系统自备电源,具有独立的IOs、时钟、基本处理器、内存和模拟单元供电轨。
Power Dissipation Management: Clever real-time programming by Wait and Stop instructions. Clever reduction of the clock rate during specific set of instructions. Optimizing the codes and clever enabling and disabling of use of caches or cache blocks.
功耗管理:通过等待和停止指令进行智能实时编程。在特定指令集期间巧妙地降低时钟速率。优化代码,巧妙地启用和禁用缓存或缓存块的使用。
Crystal: The CPU needs a clock source, and a crystal oscillator generates the clock. The Crystal is choosing based on the clock frequency of the processor. Micro-controllers provide an on chip oscillator. The clock generation circuitry determines the various states of machine cycles.
晶体:CPU需要一个时钟源,晶体振荡器产生时钟。晶体是根据处理器的时钟频率来选择的。微控制器提供片上振荡器。时钟产生电路决定机器周期的各种状态。
Reset Circuit: It is generally built in the hardware to take care of any unforeseen problems. This circuit handles software handles software hang-ups, power supply failures, etc.
复位电路:它通常内置在硬件中,以处理任何不可预见的问题。此电路处理软件挂断、电源故障等。
Watchdog timer: When value reaches zero, the processor resets. If things are fine and there is no need to reset the processor, the processor resets the watchdog timer to that large value again.
看门狗定时器:当值为零时,处理器复位。如果一切正常,不需要重置处理器,处理器会将看门狗计时器重置为该大值。
Chip-select logic circuit: The processor performs this identification through a signal called the chip-select- signal. This signal is available to all devices connected to bus and it is of either high or low level. This signal can be generated using decoder/encoder-multiplexer chip.
芯片选择逻辑电路:处理器通过一个称为芯片选择信号的信号进行识别。此信号可用于连接到总线的所有设备,它可以是高电平或低电平。该信号可由解码器/编码器复用芯片产生。
Application-specific control circuitry: Devices which needed includes sensor and transducers (to obtain real world from external sources), relays(to control external circuitry) and various input devices, such as keyboards, functional keypads etc. To control all these devices on needs circuitry to interface them with the processor.
特定于应用的控制电路:需要的设备包括传感器和传感器(从外部来源获取真实世界)、继电器(控制外部电路)和各种输入设备,如键盘、功能键盘等,以根据需要控制所有这些设备的电路,使它们与处理器接口。
I/O DEVICE: It includes Display units, Keypads.
I/O设备:包括显示单元、键盘。
Communication Interface: Networked embedded systems are provide with Ethernet interface Mobile phones and handheld-computers are provided with a number of communication interfaces is such as serial, parallel, infrared, Bluetooth,and USB (Universal Serial Bus).
通信接口:网络化嵌入式系统提供以太网接口手机,手持计算机提供串行、并行、红外、蓝牙、USB(通用串行总线)等多种通信接口。
2、What are the challenges faced in designing an Embedded System?
Ans:First, with the application mode of embedded system gradually diversified, the development complexity is improved. Second, the hardware and software design proportion changes. Third, development language changes, developers need to choose the appropriate development tools. Fourth, the challenges facing Soc design
3、Differentiate I2C and SPI
Ans:The SPI bus can implement multiple SPI devices connected to each other. the spi device that provides the spi serial clock is the spi host or master device (master), and the other devices are the spi slave or slave devices. Full duplex communication can be achieved between master and slave devices when there are multiple slave devices. the i2c bus is a bidirectional, two-wire (scl, sda), serial, multi-master control interface standard with a bus arbitration mechanism, which is very suitable for close-range, non-recurrent data communication between devices.
4、Explain the serial communication using I2C, CAN, and USB in detail.
Ans:I2C requires only two bus lines: a serial data line, a serial clock line, and each device connected to the bus can be used as a host transmitter or host receiver by using a unique address and a simple host that has always existed. CAN is a broadcast type bus, all nodes receive data on the bus, and the filtering mechanism on the hardware determines whether the message is available to the contact. The USB port supports plug-and-play and hot-plug functions of the device.
5、Explain the Embedded Software in a system
Ans:Embedded software in a system are : ROM image, Programming Languages, Program models.
ROM Image: Final stage software also called ROM image.A read-only memory (ROM) image is a file consisting of the data from a ROM chip. It usually contains the data from firmware, an arcade board, or a video game. Used in embedded systems, ROM images can also be used for testing prior to permanent writing to a ROM chip. The term ROM image is most commonly used to describe any software image — optical or chip-based — that is used during the process of hardware emulation.
Programming Languages: Machine Language Coding Programmer defines the addresses and the corresponding bytes or bits at each address. Used in configuring some specific physical device or subsystem like transceiver, the machine code- based coding is used Assembly Language Coding Needed for Invoking Processor Specific Instructions Requires understanding of the processor and instruction set. A program or a small specific part coded in the assembly language using an Assembler (software used for developing codes in assembly).Three steps when using assembly language ' Assembler', 'Linker' and 'Locator'.
Program models.
6、Explain the steps involved in the Hardware design process of an embedded system.
Ans1:First, understand the design requirements in detail, and sort out the circuit function module and performance index requirements from the requirements. Second, the selection of CPU. Third, according to the requirements of the peripheral function module components selection. Fourthly, the selected peripheral circuit of CPU reference design is modified
Ans2:
Abstraction: First abstract each problem component
Hardware and Software architecture: Each architecture layer should be well understood before a design.
System related Family designs: Families of related systems developed earlier taken into consideration during designing.
Modular Design: Decomposition of software into modules that are to be implemented. Modules should be such that they can be composed. Be clearly understood and maintain continuity. Appropriate protection strategies are necessary for each module. A module is not permitted to change or modify module functionality.
Mapping: Mapping into various representations done considering the software requirement.
User interfaces Design: Designed as per user requirements, analysis of the environment and system functions.
Refinements: Each component and module design needs to be refined till it becomes the most appropriate for implementation by the software team.
7、Chose one embedded system design and describe its part
Ans:Automotive embedded system can be summarized as four parts: sensor, controller, actuator and communication diagnosis.
Sensor: the control system first needs to sense external signals as the basis of system control. These sensors include dozens of sensors such as temperature, pressure and speed.
Controller: the core device is the microcontroller, which can complete the collection, control and communication functions.
Actuator: the real part to realize the control operation is the actuator, which converts the electrical signal output by the controller into the actual action of the driving power device.
Communication diagnosis: including communication interface circuit in electronic control unit, can, Lin and other network communication protocols of automobile, and external communication diagnosis device.
8、Compare the embedded system language in a table format.
Language |
advantage |
Ada |
It supports modularization, independent compilation, coprocessing and so on, and its reliability, maintainability and readability are quite good. |
C |
It has both the efficiency of assembly language and the ease of programming of high-level language |
C++ |
C++ has made effective improvements to C in supporting modern software engineering, oop, structure, etc. |
ASP |
ASP program does not need to compile |
JSP |
Its scripting language takes Java and completely inherits all the advantages of Java. |
PHP |
PHP has the advantages of fast learning, cross-platform, good database interaction, simple syntax, easy writing and good security. |
9、Assume embedded system and try to write the consideration for design and development of that.
Ans:
The following factors must be considered in the development and design of embedded system:
Firstly,the functions should be reliable,practical and easy to upgrade.
Secondly,concurrent processing is supposed to be real-time and responses in time.
Thirdly,the volume ought to meet the requirements and the structure should be compact.
Fourthly,the interfaces should conform to the specification and be easy to operate.
Fifthly,the embedded system should be strict with power management and have a low cost.
Lastly, it ought to have a simple and stable configuration and be convenient to maintain.
10、What is the main different between Arduino boards?
11、What is an interrupt? Explain the Device drivers for handling ISR in details.
Ans:An interrupt refers to an event that requests the processorundefineds attention and some kind of handling of a hardware or software event. As a response to the interrupt, the currently executed routine or program is interrupted to perform an ISR instead, often referred to as the device driver when the ISR serves the device
12、What should be the goals of OS?
Ans:The functions of the operating system include managing the hardware, software and data resources of the computer system, controlling the operation of the program, improving the man-machine interface, providing support for other application software, maximizing the role of all resources of the computer system, providing various forms of user interface, providing necessary services and corresponding interfaces for the development of other software, etc.
13、what is OS and mentioned the name of some OS with comparison?
Ans:Operating system is the most important software that runs on a computer. It manages the computer’s memory and processes, as well as all of its software and hardware. It also allows you to communicate with the computer without knowing how to speak the computer’s language.Without an operating system a computer is useless.
14、What is an embedded system? Give an example?
Ans:Embedded system is a special computer system with application as the center, computer technology as the basis, and software and hardware can be cut, which is suitable for the application system with strict requirements for function, reliability, cost, volume and power consumption. Like a cell phone, a cash machine or an elevator
15、Explain design and development life cycle model of an embedded systems?
Ans:embedded system’s process of design:
•Determine the requirements
•Design the system architecture
•Select the OS
•Choose the processor and peripherals
•Choose the development platform
•Choose the application and optimize
•Verify the software on the host system
•Verify the software on the target system
16、Explain the concept of Interrupt Service Routine?
Ans:the processor processing the urgent items,which can be considered as a service, is completed by executing a specific program compiled in advance. This program which processing the urgent items is called interrupt service program.
17、What is the significance of programmable bit in UART?
Ans:uart is a generic asynchronous transceiver abbreviation, is a full duplex, asynchronous communication interface, because the uart is asynchronous transmission, so each character transmitted requires a specific format; to ensure that the transmission is correct, the uart defines its own data format.
18、Explain the process to select the Arduino board
Ans:While choosing Arduino board concerning about the following aspects:
• the microcontroller type,
• The microcontroller speed (frequency)
• the physical size
• the number of input and output pins
• the memory space for programs
• the board price.
19、What Is Arduino and Why Arduino board used in embedded system?
Ans:Arduino is a convenient and flexible, easy to use open source electronic prototype platform. Contains hardware (various models of Arduino board) and software (Arduino IDE). Arduino developers have developed simple functions, there are many application libraries, Arduino developers have also developed a concise IDE. So Arduino can be used for embedded system development
20、Which Are the Official Arduino Boards?
Ans:Arduino/Genuino Uno is a single-chip development board based on ATmega328P, suitable for beginners to develop embedded systems, in addition to Mega and Nano
21、Turn on/off the 8 Led connected first odd pin then even pin打开/关闭连接的8个LED,先奇数引脚,然后偶数引脚
int ledP[]={1,2,3,4,5,6,7,8};//8个连接led的引脚
void setup() {
for(int i=0;i<8;i++){
pinMode(ledP[i],OUTPUT);//初始化8个引脚为输出
}
}
void loop() {
digitalWrite(ledP[0],HIGH);//设置该引脚为高电平,灯亮
digitalWrite(ledP[2],HIGH);
digitalWrite(ledP[4],HIGH);
digitalWrite(ledP[6],HIGH);
delay(2000);
digitalWrite(ledP[0],LOW);
digitalWrite(ledP[2],LOW);
digitalWrite(ledP[4],LOW);
digitalWrite(ledP[6],LOW);
delay(2000);
digitalWrite(ledP[1],HIGH);
digitalWrite(ledP[3],HIGH);
digitalWrite(ledP[5],HIGH);
digitalWrite(ledP[7],HIGH);
delay(2000);
digitalWrite(ledP[1],LOW);
digitalWrite(ledP[3],LOW);
digitalWrite(ledP[5],LOW);
digitalWrite(ledP[7],LOW);
delay(2000);
}
22、Turn on/off the 8 Led connected first even pin then odd pin打开/关闭连接的8个LED,先偶数引脚然后是奇数引脚
int ledP[]={1,2,3,4,5,6,7,8};//8个连接led的引脚
void setup() {
for(int i=0;i<8;i++){
pinMode(ledP[i],OUTPUT);
}
}
void loop() {
digitalWrite(ledP[1],HIGH);
digitalWrite(ledP[3],HIGH);
digitalWrite(ledP[5],HIGH);
digitalWrite(ledP[7],HIGH);
delay(2000);
digitalWrite(ledP[1],LOW);
digitalWrite(ledP[3],LOW);
digitalWrite(ledP[5],LOW);
digitalWrite(ledP[7],LOW);
delay(2000);
digitalWrite(ledP[0],HIGH);
digitalWrite(ledP[2],HIGH);
digitalWrite(ledP[4],HIGH);
digitalWrite(ledP[6],HIGH);
delay(2000);
digitalWrite(ledP[0],LOW);
digitalWrite(ledP[2],LOW);
digitalWrite(ledP[4],LOW);
digitalWrite(ledP[6],LOW);
delay(2000);
}
23、Turn on/off the 8 Led connected first four pin then second four pin打开/关闭连接的8个LED,先前四个针脚,然后后四个针脚
int ledP[]={1,2,3,4,5,6,7,8};//8个连接led的引脚
void setup() {
for(int i=0;i<8;i++){
pinMode(ledP[i],OUTPUT);
}
}
void loop() {
digitalWrite(ledP[0],HIGH);
digitalWrite(ledP[1],HIGH);
digitalWrite(ledP[2],HIGH);
digitalWrite(ledP[3],HIGH);
delay(2000);
digitalWrite(ledP[0],LOW);
digitalWrite(ledP[1],LOW);
digitalWrite(ledP[2],LOW);
digitalWrite(ledP[3],LOW);
delay(2000);
digitalWrite(ledP[4],HIGH);
digitalWrite(ledP[5],HIGH);
digitalWrite(ledP[6],HIGH);
digitalWrite(ledP[7],HIGH);
delay(2000);
digitalWrite(ledP[4],LOW);
digitalWrite(ledP[5],LOW);
digitalWrite(ledP[6],LOW);
digitalWrite(ledP[7],LOW);
delay(2000);
}
24、Turn on/off the 8 Led connected all on and all OFF打开/关闭连接的8个LED,全部打开和全部关闭
int ledP[]={1,2,3,4,5,6,7,8};//8个连接led的引脚
void setup() {
for(int i=0;i<8;i++){
pinMode(ledP[i],OUTPUT);
}
}
void loop() {
digitalWrite(ledP[0],HIGH);
digitalWrite(ledP[1],HIGH);
digitalWrite(ledP[2],HIGH);
digitalWrite(ledP[3],HIGH);
digitalWrite(ledP[4],HIGH);
digitalWrite(ledP[5],HIGH);
digitalWrite(ledP[6],HIGH);
digitalWrite(ledP[7],HIGH);
delay(2000);
digitalWrite(ledP[0],LOW);
digitalWrite(ledP[1],LOW);
digitalWrite(ledP[2],LOW);
digitalWrite(ledP[3],LOW);
digitalWrite(ledP[4],LOW);
digitalWrite(ledP[5],LOW);
digitalWrite(ledP[6],LOW);
digitalWrite(ledP[7],LOW);
delay(2000);
}
25、Read the analog value(A0) and print the value on serial port with 9600 baud rate读取模拟值(A0)并以9600波特率在串行端口上打印该值。
int Val0=0;
void setup() {
Serial.begin(9600);//设置波特率为9600
}
void loop() {
Val0=analogRead(A0);//读取A0端口的模拟值
Serial.print("A0: ");
Serial.println(Val0);//串行端口输出并换行
delay(300);
}
26、Read the analog value (A0 and A1) and print the value on serial port with 9600 baud rate
读取模拟值(A0和A1)并以9600波特率在串行端口上打印该值
int Val0=0;
int Val1=0;
void setup() {
Serial.begin(9600);
}
void loop() {
Val0=analogRead(A0);
Serial.print("A0: ");
Serial.println(Val0);
delay(300);
Val1=analogRead(A1);
Serial.print("A1: ");
Serial.println(Val1);
delay(300);
}
27、 Read the analog value (A0 and A1 and A2) and print the value on serial port with 9600 baud rate
读取模拟值(A0,A1和A2)并以9600波特率在串行端口上打印该值
int Val0=0;
int Val1=0;
int Val2=0;
void setup() {
Serial.begin(9600);
}
void loop() {
Val0=analogRead(A0);
Serial.print("A0: ");
Serial.println(Val0);
delay(300);
Val1=analogRead(A1);
Serial.print("A1: ");
Serial.println(Val1);
delay(300);
Val2=analogRead(A2);
Serial.print("A2: ");
Serial.println(Val2);
delay(300);
}
28、write the code to make the PWM pulse From 10 to 50%编写代码以使PWM脉冲从10%变为50%
int pwmPin=9; //led连接的PWM脉冲引脚
int pwmVal=0; //PWM脉冲值,控制led灯亮度
void setup() {
pinMode(pwmPin, OUTPUT);
}
void loop() {
/*analogWrite(pin, val)命令,其中pin是引脚编号,传说中只能用3,5,6,9,10,11这几条;val是0~255的整数值,对应电压从0到+5V。*/
for(pwmVal=256*0.1;pwmVal<256*0.5;pwmVal++){//PWM脉冲从10%到50%
analogWrite(pwmPin,pwmVal);//输出PWM脉冲值,设置led亮度
delay(30);
}
}
29、write the code to make the PWM pulse From 20 to 60%编写代码以使PWM脉冲从20%变为60%
int pwmPin=9; //led连接的PWM脉冲引脚
int pwmVal=0; //PWM脉冲值,控制led灯亮度
void setup() {
pinMode(pwmPin, OUTPUT);
}
void loop() {
for(pwmVal=256*0.2;pwmVal<256*0.6;pwmVal++){//PWM脉冲从20%到60%
analogWrite(pwmPin,pwmVal);//输出PWM脉冲值,设置led亮度
delay(30);
}
}
30、write the code to make the pwm pulse From 0 to 100%编写代码以使pwm脉冲从0到100%
int pwmPin=9; //led连接的PWM脉冲引脚
int pwmVal=0; //PWM脉冲值,控制led灯亮度
void setup() {
pinMode(pwmPin, OUTPUT);
}
void loop() {
for(pwmVal=0;pwmVal<256;pwmVal++){//PWM脉冲从0%到100%
analogWrite(pwmPin,pwmVal);//输出PWM脉冲值,设置led亮度
delay(30);
}
}