Ict #3 Flashcards
(34 cards)
selecting a microcontroller
The features and functionality of a microprocessors are unique to each brand or model. Before coding a microcontroller for your project, you must select a model that meets all the requirements of your design
Common features people look for in a microcontroller include I/O pins, clock frequency and storage memory, however ______.
a countless number of other specifications exist. Writing code is pointless if the hardware can’t interact with your circuit the way you need it to.
For beginners, is a brand of microcontroller commonly used amongst hobbyists and professionals alike. Its software is open source, meaning anyone can contribute to the growing pool of resources available to its users.
Arduino
are typically programmed in higher level languages such as C++ or Java.
Microcontrollers
One of the essential tools needed to program a microcontroller is an ____.
This software is usually developed by the creators of the microcontroller, and contains useful tools to help you program your microcontroller.
integrated development environment (IDE).
Common tools found in IDE’s include, _____
Depending on the application of the microcontrollers, additional features may be added as well.
code editors, compilers, and debuggers.
Once a suitable IDE is obtained, ____
you can begin writing code.
The program started with a _____ containing a general description of what the code/program does.
Comments
While this section has no effect on the programs functionality, it’s always a good to document it for future reference. User instructions, company and copyright information are also commonly placed here as well.
Comments
•The second section is the _____.
Variable Declaration
These variables are global, and can be called in any sections that follow. It is also common to create variables to describe each pins function, and set them equal to the pin number on the board to make coding more intuitive.
Variable Declaration
are commonly used as inputs or outputs, but very rarely can they be both.
void setup
In this section, the user defines which pins are inputs or outputs, as well as any other parameters that must be initialized. While the method of doing so varies for different microcontrollers, almost all of them require a similar step to configure the microcontrollers internal circuitry to fit the needs of your design.
Void setup
This section is where the function of your microcontroller is written. Any actions that require reading or writing values from pins, or computing the values of different variables is done here.
Void Loop
This step is almost always handled by the IDE. Once your code is written, it must be uploaded to the microcontrollers. Most have USB interfaces, but some smaller microcontrollers require a special hardware to be programmed. While we typically program microcontrollers in higher level languages, the microcontroller itself runs on assembly.
Compiling and Uploading
To translate code to a format usable by a microcontroller, a must be used.
compiler
is a software tool that takes higher level code and optimizes it for assembly. Assembly provides specific instructions to the microcontroller on what register operations to perform to match the operation of the original code. Once the assembly code is created, it can be uploaded to the microcontroller for testing.
compiler
is the process of identifying and removing errors from computer hardware or software Most IDE’s contain debuggers that are able to run the code step by step at the users control while keeping track of variable and register values so the user can learn exactly what point the program behaves differently than as intended. This is a form of white box testing, and provides much more information that can be used to deduce the cause of a faulty program.
Debugging
Programming process in arduino
Step 1: Set Up the Hardware
Step 2: Install the Arduino IDE
3: Set Up the Arduino IDE
4: Write Your Code (Sketch)
Step 5: Compile and Upload the Code
Step 6: Monitor and Debug
Step 7: Testing
Step 8: Iterate
Take advantage of existing libraries for more complex functionalities without needing to write everything from scratch.
Arduino Libraries:
The onboard LED, usually labelled “ON” or “PWR” on many Arduino boards, indicates that the board is receiving power. It is typically powered when the Arduino is connected to a power source, such as a USB port or External power supply.
- Power LED –
The heart of the Arduino UNO. This chip executes the code you upload to the board and all the input and output operations, controlling how the boards interact with sensors and actuators
ATmega microcontroller
A LED is connected to a digital pin 13. It can be used for basic testing (e.g. blink the LED to check if the program is running) or for debugging purposes
- Pin 13 LED –
These 6 pins are used to read analog signals (like from sensors). They convert analog voltage (0 to 5 V) into a digital value ranging from 0 to 1023, which can be used in your program
Analog pins (A0-A5)