Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel...

114
Embedded System Lab Embedded System Lab BE (COMPUTER ENGINEERING) Semester - VII Laboratory Manual Department of Computer Engineering R. C. Patel Institute of Technology, R. C. Patel Institute of Technology, Shirpur Page 1

Transcript of Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel...

Page 1: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Embedded System Lab

BE (COMPUTER ENGINEERING) Semester - VII

Laboratory Manual

Department of Computer EngineeringR. C. Patel Institute of Technology, Shirpur

R. C. Patel Institute of Technology, Shirpur Page 1

Page 2: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

VISION & MISSIONInstitute Vision:

To achieve excellence in engineering education with strong ethical values.

Mission: To impart high quality Technical Education through:

Innovative and Interactive learning process and high quality instructional programs.

Fostering a scientific temper among students by means of a liaison with the Academia, Industries and Government.

Preparing students from diverse backgrounds to have attitude for research and spirit of Professionalism.

Inculcating in students a respect for fellow human beings and responsibility towards the society.

R. C. Patel Institute of Technology, Shirpur Page 2

Page 3: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

The Shirpur Education Society’sR. C. Patel Institute of Technology, Shirpur

CERTIFICATEThis is to certify that Mr. / Miss. ________________________________of Final Year Computer Engineering, Roll No. ______has performed practical work satisfactorily in the subject Embedded System Lab, in the Department of Computer Engineering during the academic year 20__ -20__.

Date: / / 20 Subject Incharge

Place: Shirpur

Principal Head of Department

CONTENTS

Expt. No Experiment Title Page No

1 Writing basic C-programs for I/O operations.

6

R. C. Patel Institute of Technology, Shirpur Page 3

Page 4: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

2 Program to interface LCD. 11

3 Program to interface Keyboard and display key pressed on LCD. 16

4 Program to interface Graphics LCD. 22

5 Program to interface Touch Panel 28

6

Writing a scheduler / working with using RTOS for 4 tasks with priority. The tasks may be keyboard LCD, LED etc. and porting it on microcontroller/ microprocessor.

35

7Implement a semaphore for any given task switching using RTOS on microcontroller board.

42

8Create two tasks, which will print some characters on the serial port, Start the scheduler and observe the behavior.

47

9 Program to demonstrate I2C Protocol. 54

10 Program to demonstrate CAN Protocol. 62

11 Program to interface stepper motor. 67

12 Program to implement AT commands and interface of GSM modem. 72

13

Interfacing 4 x 4 matrix keyboards and 16 x 2 character LCD display to microcontroller /Microprocessor and writing a program using RTOS for displaying a pressed key.

89

14Program for exploration of (Process creation, Thread creation) using Embedded Real Time Linux.

95

R. C. Patel Institute of Technology, Shirpur Page 4

Page 5: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 01

Batch - R. C. Patel Institute of Technology, Shirpur Page 5

Page 6: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject InchargeExperiment No.1

TITLE: Writing basic C program for I/O operation.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

R. C. Patel Institute of Technology, Shirpur Page 6

Page 7: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h

R. C. Patel Institute of Technology, Shirpur Page 7

Page 8: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 8

Page 9: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:#include "macros.h"#include <ulk.h>

R. C. Patel Institute of Technology, Shirpur Page 9

Page 10: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

int main(void) PROGRAM_ENTRY;

int main (){ char user_string[100]; unsigned long a = 0;

/* User input and Display*/while(1){ ulk_cpanel_printf ("Enter the LED number to glow \n"); ulk_scanf_hex (&a); ulk_cpanel_printf ("Value is %lx\n", a); ulk_proc_led_config(a-1); ulk_proc_led_drive(a-1,1); ulk_cpanel_printf ("Do u want to test LED again? Press 'y' or else 'n' \n"); ulk_scanf_string (&user_string[0]); ulk_cpanel_printf ("Entered String is %s \n", user_string); ulk_proc_led_drive(a-1,0); if (user_string[0] == 'n') break;} return 0;}

STANDARD INPUT:Enter the LED number to glow :5

STANDARD OUTPUT:

CONCLUSION / RESULT:In this Experiment, we have designed a basic application for summation of two numbers using basic UI Elements.

R. C. Patel Institute of Technology, Shirpur Page 10

Page 11: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 02

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.2TITLE: Program to interface LCD.

R. C. Patel Institute of Technology, Shirpur Page 11

Page 12: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR

R. C. Patel Institute of Technology, Shirpur Page 12

Page 13: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 13

Page 14: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:

R. C. Patel Institute of Technology, Shirpur Page 14

Page 15: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include "macros.h"#include <ulk.h>int main(void) PROGRAM_ENTRY;int main (){

ulk_fpga_clcd_init();ulk_fpga_clcd_display_on();ulk_fpga_clcd_display_clear();ulk_fpga_clcd_cursor_home();ulk_fpga_clcd_display_string("Hello RCPIT");ulk_proc_delay(ULK_MSEC(5000));ulk_fpga_clcd_display_off();return 0;

}

Standard Output:

CONCLUSION / RESULT:We have successfully completed program for interfacing of LCD with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 15

Page 16: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 03

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.3TITLE: Program to interface Keyboard and display key pressed on LCD.

R. C. Patel Institute of Technology, Shirpur Page 16

Page 17: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR

R. C. Patel Institute of Technology, Shirpur Page 17

Page 18: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 18

Page 19: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:

R. C. Patel Institute of Technology, Shirpur Page 19

Page 20: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include"macros.h"#include<ulk.h>int main(void)PROGRAM_ENTRY;int main(){

unsignedint x;unsigned long int * p;inti,j; p=0x80500000;ulk_fpga_clcd_init();ulk_fpga_clcd_display_on();ulk_fpga_clcd_display_clear();ulk_proc_keypad_init();abc: x=ulk_proc_keypad_getkey();do{

switch(x){case 1:ulk_fpga_clcd_display_string("Pressed Key is 1");

gotoabc;case 2:ulk_fpga_clcd_display_string("Pressed Key is 2");

gotoabc;case 3:ulk_fpga_clcd_display_string("Pressed Key is 3");

gotoabc;case 7:ulk_fpga_clcd_display_string("Pressed Key is 4");

gotoabc;case 8:ulk_fpga_clcd_display_string("Pressed Key is 5");

gotoabc;case 9:ulk_fpga_clcd_display_string("Pressed Key is 6");

gotoabc;case 13:ulk_fpga_clcd_display_string("Pressed Key is 7");

gotoabc;case 14:ulk_fpga_clcd_display_string("Pressed Key is 8");

gotoabc;case 15:ulk_fpga_clcd_display_string("Pressed Key is 9");

gotoabc;case 29:ulk_fpga_clcd_display_string("");

break;default:ulk_fpga_clcd_display_string("Invalid Digit");

gotoabc;

R. C. Patel Institute of Technology, Shirpur Page 20

Page 21: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

}ulk_fpga_clcd_display_off();

}while(x!=29);return(0);}

Standard Output:

CONCLUSION / RESULT:We have successfully completed program for interfacing Keyboard and display key pressed on LCD with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 21

Page 22: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 04

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.4TITLE: Program to interface Graphics LCD.

R. C. Patel Institute of Technology, Shirpur Page 22

Page 23: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR

R. C. Patel Institute of Technology, Shirpur Page 23

Page 24: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 24

Page 25: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:

R. C. Patel Institute of Technology, Shirpur Page 25

Page 26: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include "macros.h"#include <ulk.h>int main(void) PROGRAM_ENTRY;int main (){

unsigned long int *p;unsignedint i,j,count1=0,count2=0 ;p=0x80500000;for(i=0;i<320;i++)

for(j=0;j<240;j++){

if(count1>160 && count2 >120) {

*p=0xff0000;p++;count1++;count2++;

}else if(count1>160 && count2<120){

*p=0x00ff00;p++;count1++;count2++;

}else if(count1<160 && count2 >120){

*p=0x0000ff;p++;count1++;count2++;

}else{

*p=0xffff00;p++;count1++;count2++;

} }

R. C. Patel Institute of Technology, Shirpur Page 26

Page 27: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

return 0;}

Standard Output:

CONCLUSION / RESULT:We have successfully completed program for interfacing Graphics LCD with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 27

Page 28: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 05

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.5TITLE: Program to interface Touch Panel.

R. C. Patel Institute of Technology, Shirpur Page 28

Page 29: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR

R. C. Patel Institute of Technology, Shirpur Page 29

Page 30: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 30

Page 31: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:

R. C. Patel Institute of Technology, Shirpur Page 31

Page 32: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include "macros.h"#include <ulk.h>int main(void) PROGRAM_ENTRY;struct PIXEL{

unsignedint x;unsignedint y;

};externstruct PIXEL pixel;externstruct PIXEL ulk_proc_touch_spi_enable(void);extern void ulk_proc_touch_spi_disable(void);externstruct PIXEL ulk_proc_touch_spi_poll(void);int main (){

unsignedinti,j,count=0;unsigned long int *p;pixel = ulk_proc_touch_spi_enable();ulk_cpanel_printf("Touch # %d -----------------\r\n",count);ulk_cpanel_printf("raw_X = %d raw_Y = %d\r\n",pixel.x,pixel.y);

while(count < 5){

pixel = ulk_proc_touch_spi_poll();p=0x80500000;

if((pixel.x>=100 &&pixel.x<150 ) && (pixel.y>=100 &&pixel.y<150))

{count++;ulk_cpanel_printf("Touch # %d -----------------\r\n",count);

ulk_cpanel_printf("raw_X = %d raw_Y = %d\r\n",pixel.x,pixel.y);

ulk_proc_delay(ULK_MSEC(200));ulk_proc_touch_spi_disable();for(i=0;i<320;i++)

for(j=0;j<240;j++){*p=0xff0000;p++;}

ulk_proc_delay(ULK_MSEC(200));pixel = ulk_proc_touch_spi_enable();

}

R. C. Patel Institute of Technology, Shirpur Page 32

Page 33: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

else if((pixel.x>=150) && (pixel.y>=150)){

count++;ulk_cpanel_printf("Touch # %d -----------------\r\n",count);

ulk_cpanel_printf("raw_X = %d raw_Y = %d\r\n",pixel.x,pixel.y);

ulk_proc_delay(ULK_MSEC(200));ulk_proc_touch_spi_disable();for(i=0;i<320;i++)

for(j=0;j<240;j++){*p=0x00ff00;p++;}

ulk_proc_delay(ULK_MSEC(200));pixel = ulk_proc_touch_spi_enable();

}else{

ulk_proc_touch_spi_disable();for(i=0;i<320;i++)

for(j=0;j<240;j++){*p=0x0000ff;p++;}

pixel = ulk_proc_touch_spi_enable();}ulk_proc_delay(ULK_MSEC(200));

}

/* disabling irq */ulk_proc_touch_spi_disable();return 0;

}

Standard Output:

R. C. Patel Institute of Technology, Shirpur Page 33

Page 34: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

CONCLUSION / RESULT:We have successfully completed program for interfacing of Touch Panel with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 34

Page 35: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 06

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.6TITLE: Writing a scheduler / working with using RTOS for 4 tasks with priority. The tasks may be keyboard LCD, LED etc. and porting it on

R. C. Patel Institute of Technology, Shirpur Page 35

Page 36: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

microcontroller/ microprocessor.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI Express

R. C. Patel Institute of Technology, Shirpur Page 36

Page 37: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Memory:128MB CPU RAM-mDDR64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

R. C. Patel Institute of Technology, Shirpur Page 37

Page 38: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

EXPERIMENTAL KIT:

Figure: ULK Kit

R. C. Patel Institute of Technology, Shirpur Page 38

Page 39: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PROGRAM / PSEUDO-CODE:#include “macros.h”#include<ulk.h>int main(void) PROGRAM_ENTRY;int main(){

led_blink();ulk_proc_delay(ULK_MSEC(5000));clcd();ulk_proc_delay(ULK_MSEC(5000));quad();return 0;

}void led_blink(){int i=0;while(i){

i++;ulk_proc_led_config(i);ulk_proc_led_drive(i,1);if(i==5)i=0;

}}void clcd (){

ulk_fpga_clcd_init();ulk_fpga_clcd_display_on();ulk_fpga_clcd_display_clear();ulk_fpga_clcd_cursor_home();ulk_fpga_clcd_display_string("Hello RCPIT");ulk_proc_delay(ULK_MSEC(5000));ulk_fpga_clcd_display_off();

}void quad (){

unsigned long int *p;unsigned int i,j,count1=0,count2=0 ;

R. C. Patel Institute of Technology, Shirpur Page 39

Page 40: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

p=0x80500000;for(i=0;i<320;i++)

for(j=0;j<240;j++){

if(count1>160 && count2 >120) {

*p=0xff0000;p++;count1++;count2++;

}else if(count1>160 && count2<120){

*p=0x00ff00;p++;count1++;count2++;

}else if(count1<160 && count2 >120){

*p=0x0000ff;p++;count1++;count2++;

}else{

*p=0xffff00;p++;count1++;count2++;

} }}

Standard Output:

R. C. Patel Institute of Technology, Shirpur Page 40

Page 41: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

CONCLUSION / RESULT:We have successfully completed program for scheduler / working using RTOS for 4 tasks with priority with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 41

Page 42: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 07

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.7TITLE: Implement a semaphore for any given task switching using RTOS on microcontroller board.

R. C. Patel Institute of Technology, Shirpur Page 42

Page 43: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY

Procedure:

Executing Linux applications on Explorer Board

1. Board should be in RUN mode2. Open hyperterminal @ 115200 baud rate and press Reset3. Uboot will be loaded. Do not press any key.4. Linux kernel and rootfilesystem loads5. Linux shell prompt allows user to execute Linux based applications

Target Settings to be done in Triton IDE: 6. Select Download option as FTP and Debug type as Ethernet 7. Enter Target IP address and Target Port Number 8. Select Operating System as Linux 9. Select the Baud Rate @ 115200

10. Build project in Release mode11. Generated *.out needs to be downloaded on the EXPLORER

board12. On linux shell prompt give command:

cd var/lib/tftpboot ( this will take you to tftpboot directory)13. Create a file using command:

touch <filename> (filename should be the same as that to be

R. C. Patel Institute of Technology, Shirpur Page 43

Page 44: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

downloaded on board)14. Change the permissions of the file by giving command:

chmod 777 <filename>15. Open command prompt and go to the location of compiled file16. Give the below command:

tftp –i <IPaddressofboard> PUT <filename> and press Enter17. Go to linux prompt and give command:

ls –al18. Created file has been downloaded on board19. To execute the application give command:

./<filename>20. To execute application for Debug mode:21. Build project in debug mode with appropriate target settings22. For downloading follow above steps23. To debug file give command:

gdbserver :500 <filename>24. Start debugging from Triton IDE

EXPERIMENTAL KIT:

Figure: ARM Explorer Board

PROGRAM / PSEUDO-CODE:

#include <stdio.h>#include <pthread.h>

R. C. Patel Institute of Technology, Shirpur Page 44

Page 45: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include <semaphore.h>sem_t semP, semC;int stock_count = 0;const int stock_max_limit=5;void *producer(void *arg) { int i, sum=0; for(i = 0; i < 10; i++)

{ while(stock_max_limit == stock_count)

{ printf("stock overflow, production on wait..\n"); sem_wait(&semC); printf("production operation continues..\n"); } sleep(1); //production decided here

stock_count++; printf("P::stock-count : %d\n",stock_count); sem_post(&semP); printf("P::post signal..\n"); } }void *consumer(void *arg) {

int i, sum=0; for(i = 0; i < 10; i++) {

while(0 == stock_count){

printf("stock empty, consumer on wait..\n"); sem_wait(&semP); printf("consumer operation continues..\n"); } sleep(2); //consumer rate decided here

stock_count--; printf("C::stock-count : %d\n", stock_count); sem_post(&semC); printf("C::post signal..\n"); }}

R. C. Patel Institute of Technology, Shirpur Page 45

Page 46: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

int main(void) { pthread_t tid0,tid1; sem_init(&semP, 0, 0); sem_init(&semC, 0, 0); pthread_create(&tid0, NULL, consumer, NULL); pthread_create(&tid1, NULL, producer, NULL); pthread_join(tid0, NULL); pthread_join(tid1, NULL); sem_destroy(&semC); sem_destroy(&semP); return 0;}

CONCLUSION / RESULT:We have successfully completed program for semaphore for any given task switching using RTOS on microcontroller board with all appropriate results.

Laboratory ReportExperiment No - 08

Batch -

R. C. Patel Institute of Technology, Shirpur Page 46

Page 47: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.8TITLE: Create two tasks, which will print some characters on the serial port, Start the scheduler and observe the behavior.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

R. C. Patel Institute of Technology, Shirpur Page 47

Page 48: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h

R. C. Patel Institute of Technology, Shirpur Page 48

Page 49: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 49

Page 50: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:

R. C. Patel Institute of Technology, Shirpur Page 50

Page 51: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include “macros.h”#include<ulk.h>int main(void) PROGRAM_ENTRY;

int main(){

led_blink();ulk_proc_delay(ULK_MSEC(5000));

clcd();ulk_proc_delay(ULK_MSEC(5000));

quad();return 0;}

void led_blink(){int i=0;while(i){

i++;ulk_proc_led_config(i);ulk_proc_led_drive(i,1);if(i==5)i=0;

}}

void clcd (){

ulk_fpga_clcd_init();ulk_fpga_clcd_display_on();ulk_fpga_clcd_display_clear();ulk_fpga_clcd_cursor_home();ulk_fpga_clcd_display_string("Hello RCPIT");ulk_proc_delay(ULK_MSEC(5000));ulk_fpga_clcd_display_off();

}

void quad (){

R. C. Patel Institute of Technology, Shirpur Page 51

Page 52: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

unsigned long int *p;unsigned int i,j,count1=0,count2=0 ;p=0x80500000;for(i=0;i<320;i++)

for(j=0;j<240;j++){

if(count1>160 && count2 >120) {

*p=0xff0000;p++;count1++;count2++;

}else if(count1>160 && count2<120){

*p=0x00ff00;p++;count1++;count2++;

}else if(count1<160 && count2 >120){

*p=0x0000ff;p++;count1++;count2++;

}else{

*p=0xffff00;p++;count1++;count2++;

} }

}

Standard Output:

R. C. Patel Institute of Technology, Shirpur Page 52

Page 53: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

CONCLUSION / RESULT:We have successfully completed program for creating two tasks, which will print some characters on the serial port, Start the scheduler and observe the behavior with all appropriate results.

Laboratory ReportExperiment No - 09

Batch -

Date of Experiment:__________ Date of Submission:__________R. C. Patel Institute of Technology, Shirpur Page 53

Page 54: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.9TITLE: Program to demonstrate I2C Protocol.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY:

The Titan-II board is specifically designed keeping in mind the requirements for migration from a 8 bit to 32-bit in embedded platforms development. Its

R. C. Patel Institute of Technology, Shirpur Page 54

Page 55: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

unique multiprocessor architecture empowers developers to seamlessly migrate from their existing 8- bit 8051 based solutions to 32-bit ARM platform.

Procedure:

1. Connect 9 V DC Power supply to the OASIS TITAN Board.2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE.4. Download the .hex file.5. Put the board in RUN mode and you can access external EEPROM.

EXPERIMENTAL KIT:

Fig ARM 7 Titan Board

PROGRAM / PSEUDO-CODE:

#include "address_c.h"

R. C. Patel Institute of Technology, Shirpur Page 55

Page 56: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include "functions.h"#define ENABLE 0x040#define START 0x020#define STOP 0x10#define SI 0x08#define AA 0x04#define DISABLE 0x040#define START_CLR 0x020#define STOP_CLR 0x10#define SI_CLR 0x08#define AA_CLR 0x04int data[200],length=0;int main(void){q_printf("\nin main function ");i2c_init();i2c_eeprom_write(0,0,0,16);i2c_eeprom_read(0,0,0,16);asm("loop_forever : b loop_forever");}/*@@@@@@@ delay@@@@@@@@@@@@@@@@@@@@@@@@*/void delay(u32 val){while(val--){asm("nop");}}/*@@@@@@@@@@@@@@@@@@@ init function@@@@@@@@@@@@*/void i2c_init(){q_printf("\n in init() ");*PINSEL0 = *PINSEL0 & 0XFFFFFF0F; // SELECT THE PIN for I2C*PINSEL0 = *PINSEL0 | 0X00000050;*I2CONCLR = DISABLE | START_CLR | STOP_CLR | SI_CLR | AA_CLR;*I2SCLH = 150; //set the bit frequency to 50 khz*I2SCLL = 150;}/*@@@@@@@@@@read @@@@@@@@@@@@@@@@@@@@*/void read_data()

R. C. Patel Institute of Technology, Shirpur Page 56

Page 57: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

{q_printf("\n in read() \n ");int i=0;for(i=length;i>0;i--){q_printf("%x", data[i]);}}/*@@@@@@@@@@@wait @@@@@@@@@@@@@@@@@@@@@@@@*/void wait_for_ack(u32 status){while(1){if(*I2CONSET & SI){if(*I2STAT == status){break;}else{q_printf("\n ERROR STATUS RECEIVED = ");q_printf("%x", *I2STAT);*I2CONSET = STOP;*I2CONCLR = 0xFF;asm("b loop_forever");}}}}/*@@@@@@@@@@@@ transmit function@@@@@@@@@@@*/void i2c_eeprom_write(u8 dev_addr,u8 page_no,u8 page_offset,u8 no_bytes){q_printf(" \n in write()");*I2CONSET = ENABLE;delay(1000);/*---------------------transmit a START and address with write---------------------*/*I2CONSET = START;

R. C. Patel Institute of Technology, Shirpur Page 57

Page 58: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

wait_for_ack(0x08);q_printf("\n START successful");*I2DAT = ( (dev_addr <<1)| 0XA0); // transmit slave address withwrite bit*I2CONCLR = SI_CLR;*I2CONCLR = START_CLR; // clear the START bit to avoidretransmit of STARTwait_for_ack(0x18);q_printf("\n address transmit successful");/*-----------------------transmit page no-----------------------------*/q_printf("\n transmitting page address");*I2DAT = page_no; // transmit page address*I2CONCLR = SI_CLR;wait_for_ack(0x28);*I2DAT = page_offset; // transmit offset within the page*I2CONCLR = SI_CLR;q_printf("\n page address transmitted successfully");/*-----------------------------transmit data------------------------------*/q_printf("\n transmitting data");while(no_bytes > 0){wait_for_ack(0x28);*I2DAT = 0x5A;no_bytes--;*I2CONCLR = SI_CLR;}q_printf("\n data transmitted successfully");/*-------------------transmit a STOP and do acknowledgepolling---------------------------------*/wait_for_ack(0x28);*I2CONCLR = SI_CLR;*I2CONSET = STOP ;while(!(*I2CONSET & SI)){*I2CONSET = START; // do acknowledge pollingdelay(100);*I2DAT = 0XA1;while(1){q_printf(" \n waiting");if(*I2CONSET & SI) break;

R. C. Patel Institute of Technology, Shirpur Page 58

Page 59: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

}*I2CONCLR = DISABLE | START_CLR | STOP_CLR | SI_CLR | AA_CLR;}/*@@@@@@@receive function @@@@@@@@@@@@@*/void i2c_eeprom_read(u8 dev_addr,u8 page_no,u8 page_offset,u8 no_bytes){q_printf("\n in read()");length = no_bytes;*I2CONSET = ENABLE ;delay(1000);/*---------------------transmit a START and address---------------------*/*I2CONSET = START;wait_for_ack(0x08);q_printf("\n START successful");*I2CONCLR = START_CLR; // clear the START bit to avoidretransmit of START*I2DAT = ( (dev_addr <<1)| 0XA0);*I2CONCLR = SI_CLR;wait_for_ack(0x18);q_printf("\n address transmit successful");/*-----------------------transmit page no-----------------------------*/q_printf("\n transmitting page address");*I2DAT = page_no;*I2CONCLR = SI_CLR;wait_for_ack(0x28);*I2DAT = page_offset;*I2CONCLR = SI_CLR;wait_for_ack(0x28);q_printf("\n page address transmitted successfully");wait_for_ack(0x28);*I2CONCLR = SI_CLR;*I2CONSET = START ;wait_for_ack(0x10);*I2CONCLR = START_CLR; //put the address and the read bit*I2CONSET = AA;*I2DAT = ( (dev_addr <<1)| 0XA1);*I2CONCLR = SI_CLR;wait_for_ack(0x40);*I2CONCLR = SI_CLR;/*-----------------------------receive data------------------------------*/

R. C. Patel Institute of Technology, Shirpur Page 59

Page 60: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

while(no_bytes>0){wait_for_ack(0x50);data[no_bytes] = *I2DAT;no_bytes--; *I2CONCLR = SI_CLR;}wait_for_ack(0x50);*I2CONCLR = AA_CLR;*I2CONCLR = SI_CLR;wait_for_ack(0x58);/*-------------------transmit a STOP---------------------------------*/*I2CONSET =STOP ;*I2CONCLR = DISABLE | START_CLR | STOP_CLR | SI_CLR | AA_CLR;read_data();}

OUTPUT:User can read / write data from / to external EEPROM.

CONCLUSION / RESULT:We have successfully completed to demonstrate I2C Protocol with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 60

Page 61: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 10

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.10TITLE: Program to demonstrate CAN Protocol.

R. C. Patel Institute of Technology, Shirpur Page 61

Page 62: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY:

Procedure:

1. Connect 9 V DC Power supply to the OASIS TITAN Board. 2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE for 'Transmitter' & “Receiver' .4. Download the .hex file for 'Transmit Routine' on one board.5. Download the .hex file for 'Receive Routine' on other board.6. Put the boards in RUN mode and you can transfer data on CAN.7. Accept 'PC Keyboard input' using Transmitter board and display the

same using Hyperterminal.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 62

Page 63: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Fig. ARM 7 Titan Board

PROGRAM / PSEUDO-CODE:

*****CAN Transmit Routine*****#include <LPC21xx.h>void Transmit_CAN(unsigned int);void Call_Wait(void);int main(void){unsigned int i;*PINSEL1 = 0x00054000;*C1MOD = 0x00000001;*C1GSR = 0X00000000;*C1BTR = 0x003E0005;*C1MOD = 0x00000000;Call_Wait();Transmit_CAN(0x23);Call_Wait();for(i=0;i<100;i++){Transmit_CAN(i);}

R. C. Patel Institute of Technology, Shirpur Page 63

Page 64: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

return 0;}void Transmit_CAN(unsigned int i){if((*C1SR & 0x00000004) == 0x00000004){*C1TFI1 = 0X00080000;*C1TID1 = 0X00000022;*C1TDA1 = i;*C1TDB1 = i+1;*C1CMR = 0x00000021; q_printf("Transmitting Data");Call_Wait();Call_Wait();}else{q_printf("Previous Transmission Not completed");Call_Wait();}Call_Wait();}void Call_Wait(){unsigned int i;for(i=0;i<1000000;i++);} *****CAN RECEIVE ROUTINE*****#include <LPC21xx.h>void Call_Wait(void);int main(void){*PINSEL1 = 0x00054000;*C1MOD = 0x00000001;*C1GSR = 0X00000000;*C1BTR = 0x003E0005;*C1MOD = 0x00000000;q_printf("Inside RxRoutine");Call_Wait();while(1)

R. C. Patel Institute of Technology, Shirpur Page 64

Page 65: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

{if((*C1RFS == 0x00080000) && (*C1RID == 0x00000022)){ q_printf("Frame Received correctly");}else{q_printf("RxError");}q_printf("%x\n",*C1RDA);q_printf("%x\n",*C1RDB);Call_Wait();*C1CMR = 0x00000004;Call_Wait();q_printf("%x\n",*C1SR);Call_Wait();}return 0;}void Call_Wait(){unsigned int i;for(i=0;i<1000000;i++);}

CONCLUSION / RESULT:We have successfully completed to demonstrate CAN Protocol with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 65

Page 66: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 11

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.11TITLE: Program to interface stepper motor.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

R. C. Patel Institute of Technology, Shirpur Page 66

Page 67: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY:

Procedure:

1. Connect 9 V DC Power supply to the OASIS TITAN Board. 2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE.4. Download the .hex file.5. Connect the stepper Motor as per the Pin diagram given in user

manual.6. Now set the board into RUN mode and observe the output.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 67

Page 68: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Fig. ARM 7 Titan Board

PROGRAM / PSEUDO-CODE:

#include <LPC21xx.h>#include<board.h>int main(void){unsigned long int i,j;*PINSEL0 = *PINSEL0 &(0XC03FFFFF);*IODIR0 = *IODIR0 | (0X00007800);q_lcdinit(TITAN);while(1){q_displaylcd("clkwise directxn",16);for(j=0;j<12;j++){*IOSET0 = 0x00002800;for(i=0;i<25000;i++);*IOCLR0 = 0x00002800;for(i=0;i<25000;i++);*IOSET0 = 0x00003000;for(i=0;i<25000;i++);

R. C. Patel Institute of Technology, Shirpur Page 68

Page 69: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

*IOCLR0 = 0x00003000;for(i=0;i<25000;i++);*IOSET0 = 0x00005000;for(i=0;i<25000;i++);*IOCLR0 = 0x00005000;for(i=0;i<25000;i++);*IOSET0 = 0x00004800;for(i=0;i<25000;i++);*IOCLR0 = 0x00004800;for(i=0;i<25000;i++);}q_clrscreen();q_displaylcd("anticlk directxn",16);for(j=0;j<12;j++){*IOSET0 = 0x00002800;for(i=0;i<25000;i++);*IOCLR0 = 0x00002800;for(i=0;i<25000;i++);*IOSET0 = 0x00004800;for(i=0;i<25000;i++); *IOCLR0 = 0x00004800;for(i=0;i<25000;i++);*IOSET0 = 0x00005000;for(i=0;i<25000;i++);*IOCLR0 = 0x00005000;for(i=0;i<25000;i++);*IOSET0 = 0x00003000;for(i=0;i<25000;i++);*IOCLR0 = 0x00003000;for(i=0;i<25000;i++);}q_clrscreen();}return 0;}

OUTPUT:Motor will rotate as per the defined sequence.

R. C. Patel Institute of Technology, Shirpur Page 69

Page 70: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

CONCLUSION / RESULT:We have successfully completed to interface stepper motor with all appropriate results.

R. C. Patel Institute of Technology, Shirpur Page 70

Page 71: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 12

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.12TITLE: Program to implement AT commands and interface of GSM modem.

R. C. Patel Institute of Technology, Shirpur Page 71

Page 72: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY

Code for interfacing the GSM module,4x4 keypad(new board) and lcd screen for doing four general mobile operation.

1. Making call 2. Receiving call 3. Sending SMS 4. Receiving SMS and immediately displaying first 16 character of the

SMS on LCD without acknowledge.Procedure:

Executing Linux applications on Explorer Board

1. Board should be in RUN mode2. Open hyperterminal @ 115200 baud rate and press Reset3. Uboot will be loaded. Do not press any key.4. Linux kernel and rootfilesystem loads5. Linux shell prompt allows user to execute Linux based applications

Target Settings to be done in Triton IDE: 6. Select Download option as FTP and Debug type as Ethernet 7. Enter Target IP address and Target Port Number 8. Select Operating System as Linux 9. Select the Baud Rate @ 115200

R. C. Patel Institute of Technology, Shirpur Page 72

Page 73: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

10. Build project in Release mode11. Generated *.out needs to be downloaded on the EXPLORER

board12. On linux shell prompt give command:

cd var/lib/tftpboot ( this will take you to tftpboot directory)13. Create a file using command:

touch <filename> (filename should be the same as that to be downloaded on board)

14. Change the permissions of the file by giving command: chmod 777 <filename>

15. Open command prompt and go to the location of compiled file16. Give the below command:

tftp –i <IPaddressofboard> PUT <filename> and press Enter17. Go to linux prompt and give command:

ls –al18. Created file has been downloaded on board19. To execute the application give command:

./<filename>20. To execute application for Debug mode:21. Build project in debug mode with appropriate target settings22. For downloading follow above steps23. To debug file give command:

gdbserver :500 <filename>24. Start debugging from Triton IDE

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 73

Page 74: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ARM Explorer Board

PROGRAM / PSEUDO-CODE:

#include "AT91SAM9260.h"#define linefeed 0x0D#define send_cmd 0x00#define ent_no 0x01#define snd_sms 0x02#define dial_cmd 0x00#define ent_cmd 0x01#define no 0x00#define yes 0x01int keyread(void);void lcdcmd(unsigned int);void lcddata(unsigned int);void delay_lcd(void);void waitOnPowerOnForLCD(void);void lcdcmd(unsigned int cmddata);void asciidata(unsigned int outdata);void printData(unsigned int outdata);void lcddata(unsigned int outdata);void delay_lcd(void);void clrscreen(void);void displaylcd(char* , int );void lcdinit(void);

R. C. Patel Institute of Technology, Shirpur Page 74

Page 75: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

void put_c(unsigned char );void print_str(char *str, int len);void dela(void);void recv_irq(void);void dela(void);void debounce(void);int keyread (void);void keyinit(void);void led_blink(void);unsigned char recv_ch[100];unsigned char uart_int_flag;unsigned char sms_flag;unsigned char dial_flag;unsigned char sms_start; int main(void){unsigned char key;unsigned char prev_key;key=0;prev_key=0;sms_flag = send_cmd;dial_flag = dial_cmd;uart_int_flag=no;*PIOB_ASR = 0xC000;*PIOB_PDR = 0xC000;*DBGU_CR = *DBGU_CR | 0xAC;*DBGU_MR = 0x800;*DBGU_BRGR = 0x28B; //9600*DBGU_CR = *DBGU_CR | 0x50;keyinit();lcdinit();print_str("AT\r",3);dela();dela();dela();print_str("AT+CMGF=1\r",10);dela();dela();print_str("AT+CNMI=1,2,0,0,0\r",18);dela();

R. C. Patel Institute of Technology, Shirpur Page 75

Page 76: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

dela();displaylcd("Mo On explorer",14);while(1){while((key = keyread()) == 0){if(uart_int_flag==yes)break;}if(uart_int_flag==yes){clrscreen();recv_irq();uart_int_flag=no;} if(key != prev_key){prev_key = key;switch(key){//case 0x3a:case 'A':sms_flag = send_cmd;clrscreen();switch(dial_flag){case dial_cmd:displaylcd("D>",2);put_c('A');put_c('T');put_c('D');dial_flag = ent_cmd;break;case ent_cmd:displaylcd("calling",7);put_c(';');put_c(13);dial_flag = dial_cmd;break;default:

R. C. Patel Institute of Technology, Shirpur Page 76

Page 77: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

displaylcd("Mo On METIS",11);put_c(27);print_str("AT\r",3);sms_flag = dial_cmd;break;}break;case 'B':sms_flag = send_cmd;dial_flag = dial_cmd;clrscreen();displaylcd("ATA",3);print_str("ATA\r",4);break;case 'C':sms_flag = send_cmd;dial_flag = dial_cmd;clrscreen();displaylcd("ATH",3); print_str("ATH\r",4);break;case 'D':dial_flag = dial_cmd;clrscreen();switch(sms_flag){case send_cmd:displaylcd("Mo no>",6);put_c('A');put_c('T');put_c('+');put_c('C');put_c('M');put_c('G');put_c('S');put_c('=');put_c('"');sms_flag = ent_no;break;case ent_no:

R. C. Patel Institute of Technology, Shirpur Page 77

Page 78: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

displaylcd(">",1);put_c('"');put_c(13);sms_flag = snd_sms;break;case snd_sms:displaylcd("SMS send ",12);put_c(26);sms_flag = send_cmd;break;default:displaylcd("ERROR=>Esc ",12);put_c(27);sms_flag = send_cmd;break;}break;case 'E':sms_flag = send_cmd;dial_flag = dial_cmd;clrscreen();displaylcd("Esc",3);put_c(27);break;case 'F': sms_flag = send_cmd;dial_flag = dial_cmd;clrscreen();displaylcd("Mo On Explorer",14);print_str("AT\r",3);dela();print_str("AT+CMGF=1\r",10);dela();print_str("AT+CNMI=1,2,0,0,0\r",18);dela();break;case 0x31:displaylcd(&key, 1);put_c('1');prev_key=0;

R. C. Patel Institute of Technology, Shirpur Page 78

Page 79: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

break;case 0x32:displaylcd(&key, 1);put_c('2');prev_key=0;break;case 0x33:displaylcd(&key, 1);put_c('3');prev_key=0;break;case 0x34:displaylcd(&key, 1);put_c('4');prev_key=0;break;case 0x35:displaylcd(&key, 1);put_c('5');prev_key=0;break;case 0x36:displaylcd(&key, 1);put_c('6');prev_key=0;break;case 0x37:displaylcd(&key, 1);put_c('7');prev_key=0;break;case 0x38:displaylcd(&key, 1);put_c('8');prev_key=0;break;case 0x39:displaylcd(&key, 1);put_c('9');prev_key=0;

R. C. Patel Institute of Technology, Shirpur Page 79

Page 80: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

break;case '0':key = '0';displaylcd(&key, 1);put_c('0');prev_key=0;break;default:displaylcd(&key, 1);print_str("AT\r",3);break;}}}}void put_c(unsigned char val){*DBGU_THR = val;while(!(*DBGU_SR & 0x02));}void print_str(char *str, int len){while(len-- != 0){put_c(*str);str++;}*DBGU_THR = 0x20;while(!(*DBGU_SR & 0x02));}void recv_irq(){unsigned char count;switch(recv_ch[0]){case 'R': if(recv_ch[1] == 'I'){if(recv_ch[2] == 'N'){

R. C. Patel Institute of Technology, Shirpur Page 80

Page 81: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

if(recv_ch[3] == 'G'){clrscreen();displaylcd("RING", 4);put_c(27); //0x1b-> escfor(count=0;count<2;count++)led_blink();}}}break;case ':':if(recv_ch[1] == ' '){if(recv_ch[2] == '"'){clrscreen();for(count=(sms_start+1) ;count<(sms_start+16);count++)displaylcd(&recv_ch[count],1);sms_start = 0;for(count=0;count<2;count++)led_blink();print_str("AT+CNMA\r",8);dela();}}break;default:clrscreen();break;}} int keyread(void){unsigned int key_val = 0;unsigned int row = 0,col = 0;//-------------------- Read column--------------------*PIOA_OER = 0x00F0;*PIOA_ODR =0x0F00;*PIOA_SODR = 0x00F0; col = *PIOA_PDSR & 0x0FF0;col = (col >> 4) ;

R. C. Patel Institute of Technology, Shirpur Page 81

Page 82: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

col = col+30;//------------- Read Row ----------------------------*PIOA_OER = 0x0F00;*PIOA_ODR =0x00F0;row = *PIOA_PDSR & 0x0FF0;row = (row >> 4);row = row+30;debounce();switch(col){case 0xAD:if(row == 0x2C) key_val = '1';else if(row == 0x2B) key_val = '2';else if(row == 0x29) key_val = '3';else if(row == 0x25) key_val = 'A';break;case 0x6D:if(row == 0x2C) key_val = '4';else if(row == 0x2B) key_val = '5';else if(row == 0x29) key_val = '6';else if(row == 0x25) key_val = 'B';break;case 0x4D:if(row == 0x2C) key_val = '7';else if(row == 0x2B) key_val = '8';else if(row == 0x29) key_val = '9';else if(row == 0x25) key_val = 'C';break;case 0x3D:if(row == 0x2C) key_val = 'D';else if(row == 0x2B) key_val = '0';else if(row == 0x29) key_val = 'E';else if(row == 0x25) key_val = 'F';break; default:key_val = 0;break;}return key_val;}void debounce(void){

R. C. Patel Institute of Technology, Shirpur Page 82

Page 83: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

unsigned int j;unsigned char count;unsigned char temp;unsigned char start_flag;start_flag = no;for (j=0;j<355555;j++){if((*DBGU_SR & 0x01)){count=0 ;do{if(*DBGU_SR & 0x01){temp = *DBGU_RHR;if(start_flag == no){if(temp == 'R' || temp == ':' ){recv_ch[count++]=temp;uart_int_flag=yes;start_flag = yes;if(recv_ch[0]== ':'){do{if(*DBGU_SR & 0x01)recv_ch[count++]=*DBGU_RHR;}while(recv_ch[count-1]!= '\r');recv_ch[count-1]= 0;sms_start = count-1;}}elsebreak;}elserecv_ch[count++]=*DBGU_RHR;} } while(recv_ch[count-1]!= '\r');

R. C. Patel Institute of Technology, Shirpur Page 83

Page 84: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

start_flag = no;break;}}}void dela(){unsigned long int i,d;for(i=0;i<10;i++){for(d=0;d<100;d++);}}void keyinit(void){*PMC_PCER = *PMC_PCER | (0x1 << 2);*PIOA_PER = 0xFF0; //PA4-11*PIOA_PUDR = 0xFF0;}void led_blink(void){*PIOA_OER = 0xFC0;*PIOA_SODR = 0xFC0;dela();*PIOA_CODR = 0xFC0;dela();}void waitOnPowerOnForLCD(void){unsigned int i;for(i=0; i < 65536; i++);for(i=0; i < 65536; i++);}void lcdinit(void){waitOnPowerOnForLCD();*PIOB_PER = 0x3FF;*PMC_PCER = 0x00000008;*PIOB_OER = 0x3FF;lcdcmd(0x38);lcdcmd(0x0e);lcdcmd(0x01);lcdcmd(0x06);

R. C. Patel Institute of Technology, Shirpur Page 84

Page 85: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

lcdcmd(0x80);} void cursratline1clm1(void){lcdcmd(0x80);}void inccursor(void){lcdcmd(0x06);}void clrscreen(void){lcdcmd(0x01);lcdcmd(0x80);}void lcdcmd(unsigned int cmddata){*PIOB_CODR = *PIOB_CODR | 0x1;*PIOB_CODR = *PIOB_CODR | 0x3FC;cmddata = cmddata << 2;*PIOB_SODR = *PIOB_SODR | cmddata;*PIOB_CODR= *PIOB_CODR | 0x002;delay_lcd();*PIOB_SODR = *PIOB_SODR | 0x002;delay_lcd();*PIOB_CODR = *PIOB_CODR | 0x002;}void lcddata(unsigned int outdata){*PIOB_SODR = *PIOB_SODR | 0x001;outdata = outdata << 2;*PIOB_CODR = *PIOB_CODR | 0x3FC;*PIOB_SODR = outdata;*PIOB_CODR = *PIOB_CODR | 0x002;delay_lcd();*PIOB_SODR = *PIOB_SODR | 0x0002;delay_lcd();*PIOB_CODR= *PIOB_CODR | 0x0002;inccursor();inccursor();

R. C. Patel Institute of Technology, Shirpur Page 85

Page 86: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

inccursor();} void displaylcd(char *str, int len){while(len-- != 0){lcddata(*str);str++;}}void delay_lcd(void){int j,i;for (i=0;i<5;i++)for (j=0;j<500;j++);}

CONCLUSION / RESULT:We have successfully completed program for interfacing AT commands and interface of GSM modem with all appropriate results.

Laboratory ReportExperiment No - 13

R. C. Patel Institute of Technology, Shirpur Page 86

Page 87: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.13TITLE: Interfacing 4 x 4 matrix keyboards and 16 x 2 character LCD display to microcontroller /Microprocessor and writing a program using RTOS for displaying a pressed key.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 4Gb Minimum3 HDD

Minimum 30Gb free Space

4 Wipro Unified Learning Kit

SOFTWARE CONFIGURATION:

Sr. No Software Configuration

R. C. Patel Institute of Technology, Shirpur Page 87

Page 88: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

1 Operating System Ubuntu 12.102 Eclipse Galelio3 ULK Control Panel

THEORY:

UTLP

UTLP (Unified Technology Learning Platform) is an ardent facilitator for aiding engineers gain hand-on, learn and understand complex and advance technologies simply. Besides, UTLP also concentrates on making students and freshmen industry ready as it gives them the experience of working in real time. Eventually, UTLP embraces modern technologies to bridge the gap between academia and industry. It increases individual learning towards subjects and supports and motivates students towards building and integrating concepts keeping in mind organizational practices. It also promotes and expedites Entrepreneurship and Research within the country.

Unified Learning Kit (ULK) is an integrated learning environment consisting of hardware and software tools.

System Specifications:

Processor: ARM Cortex A8 @600MHzDSP @430MHzXilinx Spartan-6 FPGA with PCI ExpressMemory:128MB CPU RAM-mDDR64MB FPGA RAM DDR24MB 128MB NAND FlashVideo/Audio INPeripherals:Dual line character LCD, Seven Segment, LED, ADC, DAC, RTC, Flexible I/O, Optional Bluetooth, Wi-Fi, and GPSJTAG support for CPU and FPGADevelopment Environment:Eclipse IDE, ULK Control PanelProcedure:

1. Creation of new project2. Select file menu then choose new option after that select c project3. Give project name then select make file project as linux gcc and then

R. C. Patel Institute of Technology, Shirpur Page 88

Page 89: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

finish4. Right click on project select new file and give file name as main.c5. Add header file macros.h6. Also add project.lds and makefile and then save into project.7. Write a program into main.c and saved it8. Right click on project name and choose CLEAN PROJECT option

then .bin file will be created9. Go to command prompt (terminal)10. Type ifconfig to know IP address11. If IP address is already set then it is okay. Otherwise go to step

1112. Type this command to set new IP sudo ifconfig eth0 192.168.2.90

up13. Enter password of the system14. Again write ifconfig and see new IP address is set or not. 15. Start ULK control panel16. Set ULK count=117. Click on list ULK18. Select the ulk which is detected and then establish the

connection19. Load the .bin file into target system from host system20. Run the project.

EXPERIMENTAL KIT:

R. C. Patel Institute of Technology, Shirpur Page 89

Page 90: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Figure: ULK Kit

PROGRAM / PSEUDO-CODE:#include"macros.h"

R. C. Patel Institute of Technology, Shirpur Page 90

Page 91: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

#include<ulk.h>int main(void)PROGRAM_ENTRY;int main(){

unsignedint x;unsigned long int * p;inti,j; p=0x80500000;ulk_fpga_clcd_init();ulk_fpga_clcd_display_on();ulk_fpga_clcd_display_clear();ulk_proc_keypad_init();abc: x=ulk_proc_keypad_getkey();do{

switch(x){case 1:ulk_fpga_clcd_display_string("Pressed Key is 1");

gotoabc;case 2:ulk_fpga_clcd_display_string("Pressed Key is 2");

gotoabc;case 3:ulk_fpga_clcd_display_string("Pressed Key is 3");

gotoabc;case 7:ulk_fpga_clcd_display_string("Pressed Key is 4");

gotoabc;case 8:ulk_fpga_clcd_display_string("Pressed Key is 5");

gotoabc;case 9:ulk_fpga_clcd_display_string("Pressed Key is 6");

gotoabc;case 13:ulk_fpga_clcd_display_string("Pressed Key is 7");

gotoabc;case 14:ulk_fpga_clcd_display_string("Pressed Key is 8");

gotoabc;case 15:ulk_fpga_clcd_display_string("Pressed Key is 9");

gotoabc;case 29:ulk_fpga_clcd_display_string("");

break;default:ulk_fpga_clcd_display_string("Invalid Digit");

gotoabc;}

R. C. Patel Institute of Technology, Shirpur Page 91

Page 92: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

ulk_fpga_clcd_display_off();}while(x!=29);

return(0);}

Standard Output:

CONCLUSION / RESULT:We have successfully completed program for interfacing 4 x 4 matrix keyboards and 16 x 2 character LCD.

R. C. Patel Institute of Technology, Shirpur Page 92

Page 93: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

Laboratory ReportExperiment No - 14

Batch -

Date of Experiment:__________ Date of Submission:__________

Title: ___________________________________________________________Evaluation 1) Attendance [2] ----------------2) Lab Performance [2] ----------------3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

Experiment No.14TITLE: Program for exploration of (Process creation, Thread creation) using Embedded Real Time Linux.PREREQUISITE: Basic Knowledge of Microprocessor and MicrocontrollerHARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration1 Processor 1.5GHz or more2 RAM 2Gb Minimum3 HDD

Minimum 30Gb free Space

4 OASIS ARM7 TITAN Board

R. C. Patel Institute of Technology, Shirpur Page 93

Page 94: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

SOFTWARE CONFIGURATION:

Sr. No Software Configuration1 Operating System Windows OS2 Triton IDE

THEORY

Procedure:

Executing Linux applications on Explorer Board

1. Board should be in RUN mode2. Open hyperterminal @ 115200 baud rate and press Reset3. Uboot will be loaded. Do not press any key.4. Linux kernel and rootfilesystem loads5. Linux shell prompt allows user to execute Linux based applications

Target Settings to be done in Triton IDE: Select Download option as FTP and Debug type as Ethernet Enter Target IP address and Target Port Number Select Operating System as Linux Select the Baud Rate @ 115200

6. Build project in Release mode.7. Generated *.out needs to be downloaded on the EXPLORER board.8. On linux shell prompt give command: cd var/lib/tftpboot ( this will take

you to tftpboot directory)9. Create a file using command: touch <filename> (filename should be

the same as that to be downloaded on board)10. Change the permissions of the file by giving command: chmod

777 <filename> 11. Open command prompt and go to the location of compiled file 12. Give the below command: tftp –i <IPaddressofboard> PUT

<filename> and press Enter 13. Go to linux prompt and give command: ls –al14. Created file has been downloaded on board.15. To execute the application give command: ./<filename>16. To execute application for Debug mode: 17. Build project in debug mode with appropriate target settings.18. For downloading follow above steps19. To debug file give command:gdbserver :500 <filename> 20. Start debugging from Triton IDE

R. C. Patel Institute of Technology, Shirpur Page 94

Page 95: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

EXPERIMENTAL KIT:

Figure: ARM Explorer Board

PROGRAM / PSEUDO-CODE:

#include <stdlib.h>#include <stdio.h>#include <unistd.h>int main (){

pid_t pid;

pid = fork();

if(pid == 0) { /* Child process: * When fork() returns 0, we are in * the child process. * Here we count up to ten, one each second. */ int j; for(j=0; j < 10; j++) {

R. C. Patel Institute of Technology, Shirpur Page 95

Page 96: Embedded System Lab  · Web viewManual. Department of. Computer . Engineering. R. C. Patel Institute of Technology, Shirpur. VISION & MISSION. Institute. Vision: To achieve excellence

Embedded System Lab

printf("child: %d\n", j); sleep(1); } _exit(0); /* Note that we do not use exit() */ } else if(pid > 0) { /* Parent process: * Otherwise, we are in the parent process. * Again we count up to ten. */ int i; for(i=0; i < 10; i++) { printf("parent: %d\n", i); sleep(1); } } else { /* Error handling. */ fprintf(stderr, "couldn't fork"); exit(1); } return 0;}

CONCLUSION / RESULT:We have successfully completed program for process creation using Embedded Linux.

R. C. Patel Institute of Technology, Shirpur Page 96