Download presentation
Presentation is loading. Please wait.
Published byMaximilian Ramsey Modified over 6 years ago
1
Introduction of Embedded C and demo programs
2
Development process of AVR projects
Control structures in C Algorithms to be studied AVR studio
3
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. Example: microwave oven, AC etc
4
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.
5
Development process of Embedded C projects
Write C programs in AVR Studio. 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 AVRISP mkII USB device, which is attached to our target board with a special 6-pin cable. Once programmed, the chip runs the program in your circuit.
6
If-statement Syntax: if( condition) { statement……. } else
7
Program for if-statement
Int a=4; Int b=5; If(a>b) printf(“ a is largest”); else printf(“ b is largest”);
8
Do- while statement Syntax: Initial counter Do { statement…….
update statement } While(condition);
9
Program for do-while Int a=4; Do { a++; } while(a>5);
10
For- statement Syntax: Program:
For( initial counter; test condition; update stmt) { statement…….. statement……... } Program: for(int i=0;i<5;i++) sprintf(str, “Hello Robosapiens”);
11
Algorithms to be studied:
Blinking LED Line follower robot Edge avoider robot Light searching robot Wall follower robot
12
1. Blinking LED Program: main() { DDRB=0XFF; while(1) PORTB=0XFF;
_delay_ms(255); PORTB=0X00; }
13
Creation of AVR Projects with AVR studio
14
Home screen of AVR STUDIO
15
Naming project as Line follower
16
Selecting Platform and Device
17
Coding window
18
Building the code
19
Build and Run the code
20
How to burn the .hex file in MCU
21
Select the HID boot flash icon
22
Click on to the find device.
23
Click on the browse button to browse the hex file.
24
Browse the file from your project folder , select the hex file and click open.
25
Finally click on to the write button to burn the hex file in the MCU.
26
THANK YOU…
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.