Biological Engineering


Microcontroller Software and Programming



Yüklə 202,98 Kb.
Pdf görüntüsü
səhifə3/16
tarix07.01.2024
ölçüsü202,98 Kb.
#212070
1   2   3   4   5   6   7   8   9   ...   16
Microcontroller Software and Programming
The specific functions of a microcontroller depend on its software or how it is programed.
2
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
How can we help you?





p
p
p g
The programs are stored in the memory. Recall that the CPU can only execute binary code,
or 
machine code
, and performs low-level operations such as adding a number to a register
or moving a register’s value to a memory location. However, it is very difficult to write a
program in machine code. Hence, programming languages were developed over the years to
make programming convenient. Low-level programming languages, such as assembly
language, are the most similar to machine code. They are typically hardware-specific and not
interchangeable among different types of microcontrollers. High-level programming
languages, such as BASIC, C, or C++, tend to be more generic and can be deployed among
different types of microcontrollers with minor modifications.
The programming languages for a specific microcontroller are determined by the
microcontroller manufacturer. High-level programming languages are dominant in today’s
microcontrollers since they are much easier for learning, interpretation, implementation, and
debugging. Programming a microcontroller often requires references to manuals, tutorials,
and application notes from manufacturers. Online digital courses and online community-
based learning are often good resources as well.
The example presented later in this chapter is a hands-on project using a microcontroller
board called Arduino UNO. Arduino is a family of open-source hardware and software,
single-board microcontrollers. They are popular and there are many online resources
available to help new users develop applications. The microcontrollers are easy to
understand and easy to use in real world applications with sensors and actuators (Arduino,
2019). The programming language of the Arduino microcontrollers is based on a language
called Processing, which is similar to C or C++ but much simpler (
https://processing.org/
).
The code can be adapted for other microcontrollers. In order to convert codes from a high-
level language to the machine code to be executed by a specific CPU, or from one language
to another language, a computer program called a 
compiler
is necessary.
Programs can be developed by users in an 
integrated development environment (IDE)
,
which is a software that runs on a PC or laptop to allow the microcontroller code to be
programmed and simulated on the PC or laptop. Most programming errors can be identified
and corrected during the simulation. An IDE typically consists of the following components:
• An 
editor
to program the microcontroller using a relevant high-level programming
language such as C, C++, BASIC, or Python.
• A 
compiler
to convert the high-level language program into low-level assembly
language specific to a particular microcontroller.
• An 
assembler
to convert the assembly language into machine code in binary bit (0 or 1)
format.
• A 
debugger
to error check (also called “debug”) the code, and to test whether the code
does what it was intended to do. The debugger typically finds syntax errors, which are
statements that cannot be understood and cannot be compiled, and redundant code,
which are lines of the program that do nothing. The line number or location of the error
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
How can we help you?





p g
g
is shown by the debugger to help fix problems. The programmer can also add error
testing components when writing the code to use the debugger to help confirm the
program does what was originally intended.
• A 
software emulator
to test the program on the PC or laptop before testing on
hardware.
Not all components listed above are always presented to the user in an IDE, but they always
exist. For the development of some systems, a hardware 
emulator
might also be available.
This will consist of a printed circuit board connected to the PC or laptop by ribbon cable
joining I/O ports. The emulator can be used to load and run a program for testing before the
microcontroller is embedded on a live measurement or control system.

Yüklə 202,98 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   16




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin