Skip to document

MES LAB Manual 21-22

Lab manual
Course

Software Engineering (CS530)

376 Documents
Students shared 376 documents in this course
Academic year: 2022/2023
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
Visvesvaraya Technological University

Comments

Please sign in or register to post comments.

Preview text

HKBK COLLEGE OF ENGINEERING

(Affiliated to VTU, Belgaum and Approved by AICTE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING NBA Accredited Programme

LABORATORY MANUAL

MICROCONTROLLER AND EMBEDDED SYSTEMS LABORATORY [As per Choice Based Credit System (CBCS) scheme] (Effective from the academic year 2018 -2019) 18CSL

PREPARED BY

Prof. Jenita J Prof. Ayesha Anjum Prof. Swaathie V

HKBK COLLEGE OF ENGINEERING

Nagawara, Bangaluru -560 045 hkbk.edu

HKBK COLLEGE OF ENGINEERING

(Affiliated to VTU, Belgaum and Approved by AICTE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Mission and Vision of the Institution

Mission  To achieve academic excellence in science, engineering and technology through dedication to duty, innovation in teaching and faith in human values.  To enable our students to develop into outstanding professional with high ethical standards to face the challenges of 21st century.  To provide educational opportunities to the deprived and weaker section of the society to uplift their socio-economic status.

Vision To empower students through wholesome education and enable the students to develop into highly qualified and trained professionals with ethics and emerge as responsible citizen with broad outlook to build a vibrant nation.

Mission and Vision of the CSE Department

Mission  To provide excellent technical knowledge and computing skills to make the graduates globally competitive with professional ethics.  To involve in research activities and be committed to lifelong learning to make positive contributions to the society.

Vision To advance the intellectual capacity of the nation and the international community by imparting knowledge to graduates who are globally recognized as innovators, entrepreneur and competent professionals.

i. Individual and Team Work : Function effectively as an individual, and as a member or leader in diverse teams and in multi disciplinary settings. j. Communication : Communicate effectively on complex engineering activities with the engineering community and with society at large, such as being able to comprehend and write effective reports and design documentation, make effective presentations and give and receive clear instructions. k. Life-long Learning : Recognize the need for and have the preparation and ability to engage in independent and life- long learning in the broadest context of technological change. l. Project Management and Finance : Demonstrate knowledge and understanding of engineering and management principles and apply these to one’s own work, as a member and leader in a team, to manage projects and in multidisciplinary environments. Programme Specific Outcomes

m. Problem-Solving Skills: An ability to investigate and solve a problem by analysis, interpretation of data, design and implementation through appropriate techniques,tools and skills. n. Professional Skills : An ability to apply algorithmic principles, computing skills and computer science theory in the modelling and design of computer- based systems. o. Entrepreneurial Ability: An ability to apply design, development principles and management skills in the construction of software product of varying complexity to become an entrepreneur

CSE @ HKBKCE i 2021-

List of Experiments

Hours/Week: 04 Exam Hours: 03 CIE Marks: 40 Total Hours: 36 Semester: 4 SEE Marks: 60

Sl No.

PART A

( Conduct the following experiments by writing program using ARM7TDMI/LPC2148 using an evaluation board/simulator and the required software tool)

Page No.

  1. Write a program to multiply two 16 bit binary numbers.
  2. Write a program to find the sum of first 10 integer numbers.
  3. Write a program to find factorial of a number.
  4. Write a program to add an array of 16 bit numbers and store the 32 bit result in internal RAM.
  5. Write a program to find the square of a number (1 to 10) using look-up table.
  6. Write a program to find the largest/smallest number in an array of 32 Numbers
  7. Write a program to arrange a series of 32 bit numbers in ascending/descending order.
  8. Write a program to count the number of ones and zeros in two consecutive memory locations. PART B ( Conduct the following experiments on an ARM7TDMI/LPC2148 evaluation board using evaluation version of Embedded 'C' & Keil Uvision-4 tool/compiler.)
  9. Display <Hello World= message using Internal UART.
  10. Interface and Control a DC Motor.
  11. Interface a Stepper motor and rotate it in clockwise and anti- clockwise direction.
  12. Determine Digital output for a given Analog input using Internal ADC of ARM controller.
  13. Interface a DAC and generate Triangular and Square waveforms.
  14. Interface a 4x4 keyboard and display the key code on an LCD.
  15. Demonstrate the use of an external interrupt to toggle an LED On/Off.
  16. Display the Hex digits 0 to F on a 7-segment LED interface, with an appropriate delay in between.

PART A

1. Write a program to multiply two 16 bit binary numbers.

AREA Multiply, CODE, READONLY ENTRY

LDR R0, =NUM ; load address of multiplicand LDRH R1, [R0] ; load First number LDRH R2, [R0,#2] ; load Second number MUL R3, R1, R2 ; R3 = R1 x R STOP B STOP ; all done

NUM DCW 0X1222,0X1133 ; Declaration of no’s to be multiply

END

OUTPUT :

2. Write a program to find the sum of first 10 integer numbers.

AREA ADD1TO10, CODE, READONLY ENTRY MOV R1,#10 ;length of array LDR R2,=ARRAY ;Load the starting address of the array MOV R4,#0 ;Initial sum NEXT LDR R3,[R2],#4 ;Load first integer of the array in R ADD R4,R4,R3 ;R4=sum of integers SUBS R1,R1,# BNE NEXT ;repeat until R1= STOP B STOP

ARRAY DCD 1,2,3,4,5,6,7,8,9, END

OUTPUT:

4. Write a program to add an array of 16 bit numbers and store the 32 bit result in internal RAM.

AREA ADDITION,CODE,READONLY ENTRY MOV R5,#6 ;length of array MOV R0,#0 ;initial sum LDR R1,=VALUE1 ;starting address of the array LOOP LDRH R2,[R1],#2 ;R2=first element of array ADD R0,R0,R2 ;add first element with initial sum SUBS R5,R5,# BNE LOOP ;repeat addition until r5= LDR R4,=RESULT STR R0,[R4] ;store the result in memory STOP B STOP

VALUE1 DCW 0X1111,0X2222,0X3333,0X4444,0X3333,0X AREA DATA2,DATA,READWRITE RESULT DCD 0X END

OUTPUT :

5. Write a program to find the square of a number (1 to 10) using look-up table.

AREA square, CODE, READONLY ENTRY MOV R1,#0X3 ; load the number to be squared LDR R0,=LOOKUP ; load the starting address of the lookup table MOV R1,R1,LSL#0X2 ; offset of value to be squared ADD R0,R0,R1 ; points to mem where square of the given no is sorted LDR R3,[R0] ; load the squared value from look-up table STOP B STOP LOOKUP DCD 0X0,0X1,0x4,0x9,0x10,0x19,0x24,0x31,0x40,0x51,0x ; look-up table END

OUTPUT :

7. Write a program to arrange a series of 32 bit numbers in ascending/descending order.

AREA Ascending, CODE, READONLY ENTRY MOV R8,#4 ;Length of the array LDR R2,=SVALUE ;Starting address of the source array LDR R3,=DVALUE ;Starting address of the destination array LOOP0 LDR R1,[R2],#4 ;Loop0 copies all the elements of source ary to dest ary STR R1,[R3],# SUBS R8,R8,# CMP R8,# BNE LOOP MOV R7,#3 ;R7=Number of pass NXTPAS MOV R5,R7 ;R5=Number of comparisons LDR R1,=DVALUE ;Loads the starting address of dest array in R 1 NXTCMP LDR R2,[R1],# LDR R3,[R1] CMP R2,R3 ;Compares first and second element of the array BLT NOSWP ;If first element is smaller, no swapping STR R2,[R1],#-4 ;Swaps the elements of the array STR R3,[R1] ADD R1,R1,# NOSWP SUBS R5,R5,#1 ;Decrement comparison counter by 1 till 0 BNE NXTCMP SUBS R7,R7,#1 ;Decrement pass counter by 1 till 0 BNE NXTPAS STOP B STOP SVALUE DCD 0X44,0X11,0X33,0X AREA DATA1,DATA,READWRITE DVALUE DCD 0X END OUTPUT :

Note: Use BGT instead of BLT for descending.

8. Write a program to count the number of ones and zeros in two consecutive memory locations.

AREA ONEZERO, CODE, READONLY ENTRY MOV R2,#0 ;Counter for ones MOV R3,#0 ;Counter for zeros MOV R7,#2 ;Counter of 2 numbers LDR R6,=LOOKUP ;Load starting address of numbers LOOP MOV R1,#32 ;Number of bits in each number LDR R0,[R6] ;Load 1st number to r NEXTBIT MOVS R0,R0,ROR #1 ;Check the bit is one or zero BHI ONES ; IF CF=1 increment r2 else increment r ZEROS ADD R3,R3,#1 ;R3 stores count of 0s B REPEAT ONES ADD R2,R2,#1 ;R2 stores count of 1s REPEAT SUBS R1,R1,#1 ; Decrement the bit counter by 1 till 0 BNE NEXTBIT ; Repeat until r1= ADD R6,R6,#4 ; Load r6=address of next number SUBS R7,R7,#1 ; Decrement the number counter by 1 till 0 BNE LOOP STOP B STOP LOOKUP DCD 0X5,0X7 ; Memory address of lookup table END

OUTPUT :

{

tx_flag = 0xff; // flag that indicate data is sending via UART VICVectAddr=0; }

else if(temp == 0x04) // check any data available to receive { // U0THR = U0RBR; emp1 = U0RBR ; // copy data into variable rx_flag = 0xff; // set flag to indicate that data is received VICVectAddr=0; } }

2. Interface and Control a DC Motor.

#include<lpc214x> void clock_wise(void); void anti_clock_wise(void); unsigned int j=0;

int main() { PINSEL2 = 0XFFFFFFF0; //IO1CLR = 0X0000ff00; IO1DIR= 0X00030000; p1 and p1 are selected as outputs. IO1SET= 0X00010000; P1 should always high.

while(1) {

clock_wise(); for(j=0;j<500000;j++); //delay

anti_clock_wise(); for(j=0;j<500000;j++); //delay

} //End of while(1) } //End of Main

void clock_wise(void) { IO1CLR = 0x00030000; //stop motor and also turn off relay

for(j=0;j<500000;j++); //small delay to allow motor to turn off IO1SET = 0X00030000; //Selecting the P1 line for clockwise and turn on motor }

void anti_clock_wise(void) { IO1CLR = 0X00030000; //stop motor and also turn off relay for(j=0;j<1000000;j++); //small delay to allow motor to turn off IO1SET = 0X00010000; //not selecting the P1 line for Anti clockwise

}

3. Interface a Stepper motor and rotate it in clockwise and anti-clockwise direction.

#include <LPC21xx> void clock_wise(void) ; void anti_clock_wise(void) ; unsigned int var1 ; unsigned long int i = 0 , j = 0 , k = 0 ;

int main(void) { PINSEL2 = 0x00000000; P1 to P1 GPIO IO1DIR |= 0x00F00000 ; P1 to P1 made as output

while(1) {

for( j = 0 ; j < 50 ; j++ ) // 50 times in Clock wise Rotation clock_wise() ; // rotate one round clockwise IO1CLR =0x00F00000 ; //clearing all 4 bits while(1); for( k = 0 ; k < 65000 ; k++ ) ; // Delay to show anti_clock Rotation for( j=0 ; j < 50 ; j++ ) // 50 times in Anti Clock wise Rotation anti_clock_wise() ; // rotate one round anticlockwise for( k = 0 ; k < 65000 ; k++ ) ; // Delay to show ANTI_clock Rotation

}

} // End of main

void lcd_init(void); void wr_cn(void); void clr_disp(void); void delay(unsigned int); void lcd_com(void); void wr_dn(void); void lcd_data(void);

int main() { PINSEL1 = 0X04000000; AD0 pin is selected IO0DIR = 0x000000FC; //configure o/p lines for lcd

delay(3200); lcd_init(); //LCD initialization delay(3200); clr_disp(); //clear display delay(3200); //delay

ptr = dis; temp1 = 0x80; //Display starting address of 1st line on LCD lcd_com(); delay(800);

while(*ptr!='\0') { temp1 = *ptr; lcd_data(); ptr ++; }

LCD

{

ptr1 = arr; temp1 = 0xC0; //Display starting address of 2nd line on

lcd_com(); delay(800);

while(*ptr1!='\0')

temp1 = *ptr1; lcd_data(); ptr1 ++; }

while(1) //infinite loop { temp = 0; adc_value = 0; AD0CR = 0x01200004; ////CONTROL register for ADC- AD0.

while(((temp_adc = AD0GDR) &0x80000000) == 0x00000000); //to check the interrupt bit

adc_value = AD0GDR; //reading the ADC value adc_value >>=6; adc_value &= 0x000003ff; temp = ((float)adc_value * (float)vol)/(float)fullscale;

if(fst_flag) { fst_flag = 0x00; for(i=0;i<8;i++) { adc[i] = adc_value; adc1[i] = temp; } }

else { n=7; for(i=n;i>0;i--) { adc[i] = adc[i-1]; adc1[n] = adc1[n-1]; n = n-1; } adc[0] = adc_value; adc1[0] = temp; } temp=0; adc_value=0; for(i=0;i<8;i++) { temp += adc1[i]; adc_value += adc[i];

Was this document helpful?

MES LAB Manual 21-22

Course: Software Engineering (CS530)

376 Documents
Students shared 376 documents in this course
Was this document helpful?
HKBK COLLEGE OF ENGINEERING
(Affiliated to VTU, Belgaum and Approved by AICTE)
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
NBA Accredited Programme
LABORATORY MANUAL
MICROCONTROLLER AND EMBEDDED SYSTEMS LABORATORY
[As per Choice Based Credit System (CBCS) scheme]
(Effective from the academic year 2018 -2019)
18CSL48
PREPARED BY
Prof. Jenita J
Prof. Ayesha Anjum
Prof. Swaathie V
HKBK COLLEGE OF ENGINEERING
Nagawara, Bangaluru -560 045
www.hkbk.edu.in