1.1 Arduino Duemilanove: Mini Project Report 8-Bit RISC Microprocessor Using VHDL

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Mini Project Report

8-bit RISC Microprocessor using VHDL

1. INTRODUCTION
The project deals with a robot that locates and follows a ball across mounted with a web camera above and being controlled by a computer .The robot specified uses an Arduino Deumilanove with a web camera mounted on it. MATLAB is used to process the images captured and locate the ball. 1.1 ARDUINO DUEMILANOVE Arduino is a popular open-source single-board microcontroller, descendant of the open-source Wiring platform designed to make the process of using electronics in multidisciplinary projects more accessible. The Arduino Duemilanove ("2009") is a microcontroller board based on the ATmega328. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.

Power The Arduino Duemilanove can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wallwart) or battery. The adapter can be connected by plugging a 2.1mm centerpositive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

Memory The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader). The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

Input and Output Each of the 14 digital pins on the Duemilanove can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. The Duemilanove has 6 analog inputs, each of which provides 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts.

Communication The Arduino Duemilanove has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega168 and ATmega328 provide UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board channels this serial communication over USB and the FTDI drivers (included with the Arduino software) provide a virtual com port to software on the computer. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the FTDI chip and USB connection to the computer (but not for serial communication on pins 0 and 1).

A SoftwareSerial library allows for serial communication on any of the Duemilanove's digital pins.

Programming The Arduino Duemilanove can be programmed with the Arduino software . The ATmega328 on the Arduino Duemilanove comes preburned with a bootloader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol (reference, C header files).

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

Physical Characteristics The maximum length and width of the Duemilanove PCB are 2.7 and 2.1 inches respectively, with the USB connector and power jack extending beyond the former dimension. Three screw holes allow the board to be attached to a surface or case.

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

Arduino IDE

An Arduino sketch must have a setup() and loop() function otherwise it will not work. The setup() function is run once and once only at the start of the program and is where you will issue general instructions to prepare the program before the main loop runs, such as setting up pin modes, setting serial baud rates, etc. Basically a function is a block of code assembled into one convenient block. For example, if we created our own function to carry out a whole series of complicated mathematics that had many lines of code, we could run that code

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

as many times as we liked simply by calling the function name instead of writing out the code again each time. The function starts with void setup() and here we are telling the compiler that our function is called setup, that it returns no data (void) and that we pass no parameters to it (empty parenthesis). If our function returned an integer value and we also had integer values to pass to it (e.g. for the function to process) then it would look something like this int myFunc(int x, int y)In this case we have created a function (or a block of code) called myFunc. This function has been passed two integers called X and Y. Once the function has finished it will then return an integer value to the point after where our function was called in the program (hence int before the function name).All of the code within the function is contained within the curly braces. A { symbol starts the block of code and a } symbol ends the block. Anything in between those two symbols is code that belongs to the function. All you need to know is that in this program, we have two functions, the first function is called setup and its purpose is to setup anything necessary for our program to work before the main program loop runs.

void setup() { pinMode(ledPin, OUTPUT); }

Our setup function only has one statement and that is pinMode. Here we are telling the Arduino that we want to set the mode of one of our digital pins to be Output mode, rather than Input. Within the parenthesis we put the pin number and the mode (OUTPUT or INPUT). Our pin number is ledPin, which has been previously set to the value 10 in our program. Therefore, this statement is simply telling the Arduino that the Digital Pin 10 is to be set to OUTPUT mode. As the setup() function runs only once, we now move onto the main function loop.

void loop() {
Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000); } The loop() function is the main program function and runs continuously as long as our Arduino is turned on. Every statement within the loop() function (within the curly braces) is carried out, one by one, step by step, until the bottom of the function is reached, then the loop starts again at the top of the function, and so on forever or until you turn the Arduino off or press the Reset switch.

A screenshot of the Arduino IDE showing the "Blink" program, a simple beginner program.

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

1.2 MATLAB MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include the following:
Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface building

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows formulating solutions to many technical computing problems, especially those involving matrix

representations, in a fraction of the time it would take to write a program in a scalar non interactive language such as C or Fortran. The name MATLAB stands for matrix laboratory. MATLAB was written originally to provide easy access to matrix software developed by the LINPACK (Linear System Package) and EISPACK (Eigen System Package) projects. Today, MATLAB engines incorporate the LAPACK (Linear Algebra Package) and BLAS (Basic Linear Algebra Subprograms) libraries, constituting the state of the art in software for matrix computation. In university environments, MATLAB is the standard computational tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the computational tool of choice for research, development, and analysis. MATLAB is complemented by a family of application specific solutions called toolboxes. The Image Processing Toolbox is a collection of MATLAB functions (called M-functions or M-files) that extend the capability of the MATLAB environment for the solution of digital image processing problems. Other toolboxes that sometimes are used to complement IPT are the Signal Processing, Neural Network, Fuzzy Logic, and Wavelet Toolboxes.

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

The MATLAB Working Environment The MATLAB Desktop The MATLAB desktop is the main MATLAB application window. As the figure shows, the desktop contains five sub windows: the Command Window, the Workspace Browser, the Current Directory Window, the Command History Window, and one or more Figure Windows, which are shown only when the user displays a graphic.

The Command Window is where the user types MATLAB commands and expressions at the prompt (>>) and where the outputs of those commands are displayed. MATLAB defines the workspace as the set of variables that the user creates in a work session. The Workspace Browser shows these variables and some information about them. Double-clicking on a variable in the Workspace Browser launches the Array Editor, which can be used to obtain information and in some instances edit certain properties of the variable. The Current Directory tab above the Workspace tab shows the contents of the current directory, whose path is shown in the Current Directory Window.

Rajagiri School of Engineering and Technology

Mini Project Report

8-bit RISC Microprocessor using VHDL

For example, in the Windows operating system the path might be as follows: C:\MATLAB\Work, indicating that directory Work is a subdirectory of the main directory MATLAB, which is installed in drive C. Clicking on the arrow in the Current Directory Window shows a list of recently used paths. Clicking on the button to the right of the window allows the user to change the current directory. MATLAB uses a search path to find M-files and other MATLAB-related files, which are organized in directories in the computer file system. Any file run in MATLAB must reside in the current directory or in a directory that is on the search path. By default, the files supplied with MATLAB and MathWorks toolboxes are included in the search path. The easiest way to see which directories are on the search path, or to add or modify a search path, is to select Set Path from the File menu on the desktop, and then use the Set Path dialog box. It is good practice to add any commonly used directories to the search path to avoid repeatedly having the change the current directory. The Command History Window contains a record of the commands a user has entered in the Command Window, including both current and previous MATLAB sessions. Previously entered MATLAB commands can be selected and re-executed from the Command History Window by right-clicking on a command or sequence of commands. This action launches a menu from which to select various options in addition to executing the commands. This is a useful feature when experimenting with various commands in a work session.

Rajagiri School of Engineering and Technology

You might also like