You are on page 1of 24

INTRODUCTION TO EMBEDDED SYSTEM AND

EMBEDDED C and Tools


Embedded system
• An Embedded system is combination of computer
hardware and software, and perhaps additional
mechanical or others parts, designed to perform a
specific task.
• An embedded system is a computer system designed
to do one or a few dedicated and/or specific
functions often with real-time computing constraints
• Example:
microwave oven, AC etc
Embedded system cont….
Characteristics:-
• Embedded systems are designed to do some specific
task, rather than be a general-purpose computer for
multiple tasks.
• Embedded systems are not always standalone devices.
• The program instructions written for embedded
systems are referred to as firmware, and are stored in
read-only memory or Flash memory chips. They run
with limited computer hardware resources.
What is Embedded C?
• Embedded C is nothing but a subset of C language
which is compatible with certain microcontrollers.
• Some features are added using header files like
<avr/io.h>, <util/delay.h>.
• scanf() and printf() are removed as the inputs are
scanned from the sensors and outputs are given to
the ports.
• Control structures remain the same like if-statement,
for loop, do-while etc.
Development process of Embedded C projects
• Write C programs in AVR Studio IDE(Integrated Development
Environment)
• Compile them into a .hex file using the AVR-GCC compiler (which
integrates into AVR Studio)
• Simulate the target AVR program and debug the code within AVR
Studio
• Program the actual chip using the USBasp device, which is
attached to our target board with a special 6-pin cable
• Once programmed, the chip runs the program in your circuit
If-statement

• Syntax:
if( condition)
{
statement…….
}
else
{
statement……..
}
Do- while statement
• Syntax:
Initial counter
Do
{
statement…….
update statement
}
While(condition);
For- statement
• Syntax:
For( initial counter; test condition; update stmt)
{
statement……..
statement……...
}
• Program:
for(int i=0;i<5;i++)
sprintf(str, “Hello ”);
• To continue further,
• Install:
– WINAVR
– AVRSTUDIO 4
• The setup files are given in the C.D.
Creation of AVR Projects with AVR studio
• To continue this lab:
– Make sure you install:
• WINAVR
• AVR STUDIO
Using the setup file given in the C
Home screen of AVR STUDIO
New project window
Naming the projects

Then Click On Next. And Make sure that Create folder check box is
always checked.
Selecting Platform and Device

Then click on Finish.


Coding window
Buidling the code

Click On Built from the menu bar or press F7.


Build Status

If there is no error in the code the Build succeeded without any error.
Installing the Driver

• Open the Device Manager window, from the list


select the USBasp from LibUSB-Win32Devices.

• As you double click on USBasp, a window opens. In


the Drivers tab click on the Update Driver button,
this will give you the option for searching for the
driver in the system.
Installing the Driver conti…

• Browse folder of USBasp driver provided in


the CD and click on the next.
• It will automatically install the driver.
• This driver will work for 32 bit OS.
HID BOOT FLASH

1) Run HID BOOTFLASH


2) Click on Find Device
• Select the ‘*.hex’ file from Default folder in
your Project folder.
• Click on Flash device.
• Make sure that ‘REBOOT AVR’ is Checked
THANK YOU

You might also like