Professional Documents
Culture Documents
RTOS
Arduino
1) What is Arduino?
Arduino is an open source electronic platform. It is based on easy-to-use
hardware and software. It able to read input signal. It is used to write and upload
the computer code to the physical board by using Arduino.
It is easy to use.
It runs on Cross platform.
Low cost
It is open source.
Setup( ) function
Loop( ) function
int z = 0;
z = x+y ;
}
13) Which function is used to find the length of string?
Strlen() functions is used to find the length of string.
delayMicroseconds() :
millis()
micros()
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers -
students, hobbyists, artists, programmers, and professionals - has gathered around this
open-source platform, their contributions have added up to an incredible amount of
accessible knowledge that can be of great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming.
As soon as it reached a wider community, the Arduino board started changing to adapt
to new needs and challenges, differentiating its offer from simple 8-bit boards to
products for IoT applications, wearable, 3D printing, and embedded environments. All
Arduino boards are completely open-source, empowering users to build them
independently and eventually adapt them to their particular needs. The software, too,
is open-source, and it is growing through the contributions of users worldwide.
There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's
Handyboard, and many others offer similar functionality. All of these tools take the
messy details of microcontroller programming and wrap it up in an easy-to-use
package. Arduino also simplifies the process of working with microcontrollers, but it
offers some advantage for teachers, students, and interested amateurs over other
systems:
In general, we restrict use of the name "Arduino" to the official boards. If you find a
product under a different name but described as "Arduino compatible", it’s probably
not an official board and doesn’t fund continued work on the project.
6. Question 6. Can I Use The Arduino Logo To Identify Non Commercial Content?
Answer :
If you're creating tutorials, managing a local community of Arduino users, opening up
an Arduino-focused page online (ie. social networks) you can use the Arduino
Community Logo! This will allow people identify better what comes directly from us,
and what comes from the community.
7. Question 7. I Want To Design My Own Board, What Should I Do?
Answer :
The reference designs for the Arduino boards are available from their specific product
pages. They're licensed under a Creative Commons Attribution Share-Alike license, so
you are free to use and adapt them for your own needs without asking permission or
paying a fee. If you're looking to make something of interest to the community, we'd
encourage you to discuss your ideas on the hardware development forum so that
potential users can offer suggestions.
10. Question 11. Can I Use A Different Ide To Program The Arduino Board?
Answer :
It is possible to compile programs for the Arduino using other build tools (e.g.
Makefiles and/or AVR Studio). You'll need to configure these to link against the
appropriate files in the Arduino core libraries.
11. Question 12. Can I Use An Arduino Board Without The Arduino Software?
Answer :
Sure. It's just an AVR development board, you can use straight AVR C or C++ (with
avr-gcc and avrdude or AVR Studio) to program it.
12. Question 13. Can I Program An Arduino Board Without The Arduino Ide?
Answer :
Yes, you can use Create web editor to program your board without the need of
download the classic IDE.
13. Question 14. Can I Use The Arduino Software With Other Avr Boards?
Answer :
Yes, although it may require some modifications to the Arduino core libraries.
15. Question 18. The Arduino Ide Has Been Showing “uploading Sketch...” For A
Long Time. Why Hasn’t It Finished Uploading?
Answer :
Occasionally the uploading process gets hung up. Click the Upload button again and it
will restart the upload process. Uploading the sketch shouldn’t take more than 10
seconds.
16. Question 19. What Are The Different File Extensions For?
Answer :
While creating a sketch in the Arduino IDE, you have access to a number of different
file extensions for use with your source code files. Each one has its own particular use
which I'll explain below.
o .ino : This is the main extension for your sketch file(s). Your primary
sketch file must be an .ino file named the same as the directory it is
located in. You can create additional .ino files in your sketch named
however you like. Before compilation, all additional .ino files are
appended to the primary sketch file. They are copied in ascending order
based on the file name, and all are run throguh the standard process of
gathering includes and generating prototypes. For more information on
what the IDE does beofre compiling your code, visit this FAQ: What
does the IDE change in my sketch?
o .pde : This is the default extension for sketches written for the Arduino
IDE prior to the release of version 1.0. if you use an IDE version of at
least 1.0.0 or greater, you should rename your sketch file from .pde
to .ino. Also keep your IDE up to date, pre 1.0 versions do not support
many new libraries due to significant changes to the Arduino core API.
o .h : Header files, or files with the extension .h can be utilized in a
number of ways. If your sketch uses a set of constants that multiple .cpp
or .ino files may use, you can create a single location for your common
variables. Functions that are defined in different .cpp files can have their
declarations placed in a header for easy reuse.
o .cpp : This extension is a C++ source file. Sometimes a sketch becomes
quite large and you can utilize a .cpp file to separate sections of your
code. Definitions inside a .cpp file that you want to access elsewhere
should have their declarations inside a header (.h) file. This allows your
sketch to include the header, and its functionality. Also an important
point is; your .cpp files do not go through the IDE pre-compilation
modifications, and therefore have no prototypes generated. For more
information on using multiple files, visit this article: Breaking a sketch
into multiple files.
o .c : If you wish to write C code and use it within Arduino, you need to
use a .c extension instead of a .cpp file. Using a .c file alone however is
not the complete solution.
17. Question 20. Is There Another Ide For Arduino?
Answer :
There are a few different solutions you can use, there are plugins and modifications
for mainstream IDE packages. And a few talented people have created standalone
applications specifically for Arduino and AVR development.
18. Question 21. Can I Use Alternative Serial Monitors With Arduino?
Answer :
Yes, alternative serial monitors can be used. The arduino connects with the computer
using a virtual serial port over USB. This means any application on your computer can
potentially connect with the Arduino. Not to mention the fact you can write your own
programs which can talk to your project using the serial port.
I have personally used HTERM and it met all my needs. Many people have used the
other listed applications with positive results.
o Adds an include file for the Arduino core: This process is a fairly
harmless addition, if users include Arduino.h explicitly, the header has
#ifndef guards protecting it from multiple declaration errors which is
typical when including an unprotected header into multiple locations.
o Generates function prototypes: This is also a generally unobtrusive step.
As with protected include files, you can have multiple declarations of a
function, it is the definitions which must be unique.
o Collects included libraries: As the sketch is compiled in a temporary
location, the IDE needs to ensure all include paths are valid. To
accomplish this the IDE scans the sketch for all headers that match files
residing in the libraries folder, then it simply copies the library source
files into the temporary location along with the sketch.
This has been a source of error for many new Arduino users attemping to write their
own libraries. As confusing as it sounds, any library included into other libraries must
also be included in the sketch; simply so it can be copied to the temporary location.
To show a quick example of what the modifications look like; here is the
BareMinimum sketch, and its modified result.
o Before---expand source
o After----expand source
The modifications performed are great for beginners that do not know the C++
fundamentals required for building simple sketchs. The sketch looks tidier to the
novice with only a setup()/loop() implementation cluttering up the workspace.
However once you start using certain C++ features you can run into some common
pitfalls as a result of these modifications.
20. Question 23. Why Do #ifdef Macro's Stop The Sketch From Compiling?
Answer :
The IDE has been known to cause errors with certain uses of #ifdef.
The compiler used by the IDE is called avr-gcc and it is a C++ compiler. The
languages listed below are compatible with avr-gcc and can be used to program your
sketches in the IDE.
o C
o C++
o Inline ASM
The IDE has access to a large API for use with your Arduino development boards.
The source code is freely available for you to extract and modify as you wish. The
API also sits on top of a robust and industry standard framework for manipulating the
CPU directly. So when you need more performance from your device you can leave
parts of the Arduino API out directly control the hardware. An example is port
manipulation over Arduinos digitalRead/Write functionality.
RTOS
A real-time system is a time-bound system that has well-defined fixed time constraints.
Processing must be done within the defined constraints or the system will fail.
What is RTOS?
RTOS stands for Real-Time Operating System. It specially designed to run the application with
very precise timing and a high degree of reliability. An RTOS system must have response time
predictability and it must be deterministic.
RTOS offers services that allow tasks to be performed within predictable timing constraints.
The kernel is a computer program that is the core of a computer’s operating system, with
complete control over everything in the system. On most systems, it is one of the first programs
loaded on start-up (after the bootloader). It handles the rest of the start-up as well as input/output
requests from software, translating them into data-processing instructions for the central
processing unit. It handles memory and peripherals like keyboards, monitors, printers, and
speakers.
Multitasking allows the user to run several tasks at the same time. However, only one task is
active at a time for user interaction, but the processing ability of the computer’s processors is so
fast and smooth that it gives the impression of performing multiple tasks at the same time.
What is semaphore?
Semaphore is simply a variable that is non-negative and shared between threads. This variable is
used to solve the critical section problem and to achieve process synchronization in the
multiprocessing environment. A semaphore is a signaling mechanism, and a thread that is
waiting on a semaphore can be signaled by another thread.
What is mutex?
A Mutex is a mutually exclusive object which protects the shared resources from simultaneous
access by multiple threads or processes. It acts as a gatekeeper to a section of code allowing one
thread in and blocking access to all others. This ensures that the code being controlled will only
be hit by a single thread at a time.
embedded systems
Hardware
Processor
Memory
Timers
I/O circuits
System application specific circuits
Application specific Software
Real Time Operating System
It runs a process as per scheduling and do the switching from one process to
another
The I/O devices of embedded system are classified into two categories
Serial
Parallel
Microcontroller have I/O, memory, etc. built into it and specifically designed for
control
DMA address deals with physical addresses. It is a device which directly drives the
data and address bus during data transfer. So, it is purely physical address.
Interrupt latency is a time taken to return from the interrupt service routine post
handling a specific interrupt. By writing minor ISR routines, interrupt latency can
be reduced.
10) Mention what are buses used for communication in embedded system?
While ISA, EISA, PCI are standard buses for parallel communication used in PCs,
computer network devices, etc.
13) Explain what is the need for an infinite loop in embedded systems?
Embedded systems require infinite loops for repeatedly processing or monitoring
the state of the program. For instance, the case of a program state continuously
being verified for any exceptional errors that might just happen during run-time
such as memory outage or divide by zero, etc.
Mutexes Semaphores
A mutex object enables one thread into a
controlled section, forcing other threads Semaphore allows
which tries to gain access to that section to multiple access to
wait until the first thread has moved out from shared resources
that section
A semaphore can be
Mutex can only be released by thread which
signaled from any other
had acquired it
thread or process.
Ans: As now you are fundamentally familiar with what is a microcontroller And
microprocessor, it is easy to recognize the significant contrasts between a
microcontroller and microprocessor.
1. Key difference in both of them is the presence of external peripheral, where
microcontrollers have RAM, ROM, EEPROM embedded in it while we have to use
external circuits in the case of microprocessors.
2. As all the peripheral of microcontrollers are on the single-chip it is compact while the
microprocessor is bulky.
1. Question 1. What Is The Difference Between Embedded Systems And The System
In Which Rtos Is Running?
Answer :
Embedded system is just combination of s/w and h/w that is some embedded system
may have os some may not and rtos is an os.
OR
Embedded system can include RTOS and cannot include also. it depends on the
requirement. if the system needs to serve only event sequentially, there is no need of
RTOS. If the system demands the parallel execution of events then we need RTOS.
Why Do We Need A Infinite Loop In Embedded Systems Development? What Are The
Different Ways By Which You Can Code In A Infinite Loop?
Answer :
The infinite loops are coded in to give a delay or sleep to the program execution for a specific
amount of clock ticks. They can be implemented as:
while(;;);
for();
(or)
Loop:
goto Loop;
Power supply.
Processor.
Memory.
Timers-Counters.
Communication Ports.
I/O circuits.
Application-Specific Circuits.
Assembler.
Emulator.
Debugger.
IDE and Compiler.
Microprocessor Microcontroller
A microprocessor has only a CPU inside them in A microController has all the things like RAM,
one or a few Integrated Circuits. Eg, 8085, 8086 etc ROM, and timer ..etc on the chip. Eg. 8051, PIC
series, etc.
Because it has only a processor, so memory and It is a complete package. You only need to attach
I/O components need to be connected externally. require external peripheral like LED, LCD, etc. The
microController has a processor along with
internal memory and I/O components.
Memory and I/O has to be connected externally, Memory and I/O are already present, and the
so the circuit becomes large. internal circuit is small.
You can’t use it in compact systems You can use it in compact systems.
Cost of the entire system is high Cost of the entire system is low
Due to external components, the total power As external components are low, total power
consumption is high. Therefore, it is not ideal for consumption is less. So it can be used with devices
the devices running on stored power like batteries. running on stored power like batteries.
Most of the microprocessors do not have power- Most of the microcontrollers offer power-saving
saving features. mode.
Microprocessor has a smaller number of registers, Microcontroller has more register. Hence the
so more operations are memory-based. programs are easier to write.
Microprocessors are based on the Von Neumann Micro controllers arc based on Harvard
model architecture
It has no RAM, ROM, Input-Output units, timers, It has a CPU along with RAM, ROM, and other
and other peripherals on the chip. So the circuit peripherals embedded on a single chip. All most all
connection will be complicated. require things on single-chip so circuit connection
will be easy and a newbie easily interface I/O
devices.
It uses an external bus to interface to RAM, ROM, It uses an internal controlling bus.
and other peripherals.
Microprocessor-based systems can run at a very Microcontroller based systems run up to 200MHz
high speed because of the technology involved. or more depending on the architecture.
It’s used for general purpose applications that It’s used for application-specific systems.
allow you to handle loads of data.
It’s complex and expensive, with a large number of It’s simple and inexpensive with less number of
instructions to process. instructions to process.
What is interrupt latency?
It is an important question that is asked by the interviewer to test the understanding of
Interrupt. Basically, interrupt latency is the number of clock cycles that are taken by the
processor to respond to an interrupt request. This number of the clock cycle is count
between the assertions of the interrupt request and the first instruction of the interrupt
handler.
An embedded system is a hardware system attached with software that is designed to perform a
dedicated function or a specific task, either as an independent system or as a part of a large
system.