Saturday 28 November 2015

ARM Assembly Language Programs

Microcontroller & Embedded Systems

1. Write ARM assembly language program to find largest/smallest value from given two numbers.
    
        AREA    bigger, CODE, READONLY
ENTRY
MAIN
        LDR    R1, Value1        ;load first value to be compared
        LDR    R2, Value2        ;load second value to be compared
       
        CMP    R1, R2             ;compare them
        BHI    DONE               ;if R1 contains the highest
       
        MOV R1, R2                ;otherwise overwrite R1
       
DONE
        STR    R1, Result            ;store the result
        SWI    &11
       
Value1    DCD    &12345678        ;value to be compared
Value2    DCD    &87654321        ;value to be compared
Result    DCD    0                          ;space to store result
        END


2. Write ARM assembly language program to find average of two numbers.

             AREA    Average, CODE, READONLY                    ; name code block
             ENTRY                                             ; marker of first executable instruction
start             
             ADR    r1, FIRSTNUM                                ; load first address into r1
             ADR    r2, SECONDNUM                                ; load second address into r2
             ADR    r3, AVGRESULT                                ; load result address into r3
             LDR    r4, [r1]                                    ; load first number into r4
             LDR    r5, [r2]                                    ; load second number into r5
             ADD    r0, r4, r5                                    ; add numbers together
             MOV    r0, r0, ASR#1                                ; divide by two using arithmetic shift
             STR    r0, [r3]                                    ; store result to address pointed to by r3
                      
             SWI    0x11                                        ; terminate the program
            
FIRSTNUM    DCD    &20
SECONDNUM    DCD    &50
AVGRESULT    DCD    &0           
            END                                                 ; marks the end of the file

ARM Assembly Language Programs

Microcontroller & Embedded Systems

1. Write ARM assembly language program to display "Hello World"

        AREA      HelloW, CODE, READONLY
SWI_WriteC        EQU  &0   
SWI_Exit         EQU  &11   
        ENTRY   
 

START     ADR        R1, TEXT   
LOOP     LDRB    R0, [R1], #1
       

        CMP      R0, #0
        SWINE    SWI_WriteC   
        BNE        LOOP
        SWI        SWI_Exit    
       
TEXT    =        "HELLO WORLD", &0a, &0d, 0
        END


2. Write ARM assembly language program to find the one's complement (inverse) of a number.

        AREA    Program, CODE, READONLY
        ENTRY

Main
        LDR     R1, Value                        ; Load the number to be complemented
        MVN     R1, R1                          ; take 1's complement of R1
        STR     R1, Result                        ; Store the result
        SWI     &11

Value   DCD     &FF                            ; Value to be complemented
Result  DCD     &ABCD1234              ; Storage for result

        END



3. Write an assembly language program to compute 4x2 +3x... ... if x is stored in r1. Store the result in r0.

                AREA    equation, CODE, READONLY
                ENTRY

start
                MUL r0, r1, r1                     ; result <-- x * x
                LDR r2, =4                         ; tmp <-- 4
                MUL r0, r2, r0                     ; result <-- 4 * x * x
                LDR r2, =3                         ; tmp <-- 3
                MUL r2, r1, r2                     ; tmp <-- x * tmp
                ADD r0, r0, r2                     ; result <-- result + tmp
stop          B     stop
                end   

ARM Assembly Language Program to add / sub / mul two 32 / 64 bit numbers.

Microcontroller & Embedded Systems

1. Write ARM assembly language program to add two 32 bit numbers.


        AREA    add32, CODE, READONLY
ENTRY
MAIN
        LDR    R0, =Value1
        LDR    R1, [R0]
           
        ADD    R0, R0, #0*4
           
        LDR    R2, [R0]
           
        ADD R1, R1, R2
           
        LDR    R0, =Result
           
        STR    R1, [R0]
           
        SWI    &11
           
Value1    DCD    &37E3C123
Value2    DCD    &367402AA
           
Result    DCD    0


2. Write ARM assembly language program to add two 64 bit numbers.
     
        AREA    add64, CODE, READONLY
ENTRY
MAIN
        LDR    R0, =Value1        ;pointer to first value
        LDR    R1, [R0]            ;load first part of value1
        LDR    R2, [R0, #4]        ; load lower part of value1
        LDR    R0, =Value2        ;pointer to second  value
        LDR    R3, [R0]            ;load upper part of value2
        LDR    R4, [R0, #4]        ; load lower part of value2
      
        ADDS    R6, R2, R4        ;add lower 4 bytes  and set carry flag
        ADC    R5, R1, R3        ;add upper 4 bytes  including carry
      
        LDR    R0, =Result        ;pointer to result
      
        STR    R5, [R0]            ;store upper part of result
        STR    R6, [R0, #4]        ;store lower part of result
      
        SWI    &11
      
Value1    DCD    &12A2E640, &F2100123
Value2    DCD    &001019BF, &40023F51
Result    DCD    0
      
        END

Friday 20 November 2015

University Question Paper Analysis

University Question Paper Analysis

Microcontroller & Embedded Systems

Following table shows Marks allotted to each chapter for MES subject (weightage of chapter) in University Examinations.


Chapter No
Marks of Questions (120 Marks)
Dec 2014
Marks of Questions
(120 Marks)
May 2015
1
5
5
2
24
25
3
25
24
4
26
16
5
28
38
6
12
12
 

Thursday 15 October 2015

Assembly Language Programming of 8051

        Chapter 03  Assembly Language Programming of 8051

  1. Indicate which mode and which timer  are selected for each of the following. (a) MOV TMOD,#01H (b) MOV TMOD,#20H (c) MOV TMOD,#12H
  2. Write a program to create a square wave of 50% duty cycle (with equal portions of high and low) on the P1.5 bit. Use Timer 0 to generate the time delay.
  3. Write a program to transfer the message “Best of Luck” serially at 9600 baudrate, 8-bit data, 1 stop bit. Do this continuously.
  4. Describe SWAP A and MOVX @DPTR, A instruction of 8051.
  5. Explain addressing modes of 8051.
  6. Write assembly language program for 8051 to find largest number from a data block of ten bytes that present in internal memory locations 20H to 29H. Store the result in memory location 2AH.
  7. Compare AJMP, LJMP, SJMP instructions of 8051.
  8. Explain any 10 instructions of 8051.
  9. Explain Addressing modes of 8051.
  10. Write a program on Arithmetic operations.
  11. Write assembly language program to generate a rectangular waveform of frequency 1KHz and 30% duty cycle at pin P1.0 using 8051. Assume 8051 is operating at frequency 12MHz.
  12. Write assembly language program for 8051 to multiply two 8 bit numbers stored in external memory locations 4000H and 4001H. Send the result on PORT 1 and PORT 3.
  13.  Write a program on Logical operations.
  14.  Write assembly language program for 8051 to transfer message “BVCOE, Navi Mumbai” at the baud rate of 4800 in mode 1.
  15.  Write assembly language program to compute 1+2+……+n (say 15) and save the sum at 70h.
  16. Write assembly language program for 8051 to convert Packed BCD number to ASCII number and store it in 32 H and 33H. Packed BCD number is stored at RAM location 30H. 
  17. Write assembly language program for 8051 to find fibonacci series of N given number.
  18. Write assembly language program for 8051 for checking the parity of number is odd or even.
  19. Write assembly language program for 8051 to add two 16 bit BCD numbers.
  20. Write assembly language program for 8051to Subtract two 16 bit numbers.
  21. Write assembly language program for 8051 to sort numbers in ascending/descending order.
  22. Write assembly language program for 8051 to find least/smallest number in array.
  23. Write assembly language program for 8051 to find 2’s complement of number.   
  24. Write assembly language program for 8051 to find average of block of N bytes.

Introduction to Embedded Systems


Chapter 01 Introduction to Embedded Systems

1. What is Embedded System? Discuss various components of embedded system.
2. Define and classify embedded systems, give some examples of such systems.
3. What are the categories of  embedded systems? give some examples.
4. To design embedded system, which specialities of embedded system to be considered?
5. Discuss recent trends in embedded systems.
6. With neat diagram, explain hardware architecture of embedded system.
7. Give difference between CISC and RISC.

8. Write various functions of DSP.  
9. What do you mean SOC? Explain the concept in detail.