Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Delhi Technological University Assignment Embedded Systems

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

DELHI TECHNOLOGICAL UNIVERSITY

ASSIGNMENT
EMBEDDED SYSTEMS

TO-MS. BANI GANDHI


BY
NAME-SHWETA KAIM
ROLL NO-2K17/EC/159
DEPTT.-ECE-E
1 What is the difference between FSR and BSR?
The File Select Registers (FSR) are 16-bit registers used as memory
pointers for indirect addressing of data memory. Indirect
addressing (see in later work) allows the user to access a location
in data memory without giving a fixed address in the instruction.
FSRs are located in RAM and can be manipulated under program
control.
The bank select register (which is 4 bit wide) plus an 8-bit address
combine to form the 12-bit data memory address when the a-bit in the
instruction is a logic one. The data memory is partitioned into multiple
banks which contain the special function registers and the general
purpose registers. Number of banks may vary depending on the
microcontroller; for example, micro PIC16F84 has only two banks.

Each bank extends up to 7Fh (128 bytes). The lower locations of each
bank are reserved for the Special Function Registers. Above the Special
Function Registers are General Purpose Registers, implemented as
static RAM. While program is being executed, it is working with the
particular bank. The default bank is bank0.

To access a register that is located in another bank, one should access it


inside the program. There are special registers which can be accessed
from any bank, such as STATUS register.
2.WAP for displaying a digit using seven segment display using
pic microcontroller.

#include <xc.h>
#include "config.h" // Configuration bits file stored in a header file
#define _XTAL_FREQ 20000000 //define crystal frequency to 20MHz

// This array stores binary bit pattern that will be send to PORTD
unsigned char
binary_pattern[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6
F};

void main(void)
{
TRISD = 0x00; //define PORTD as a output pin
while(1)
{
//this loop sends all binary patterns to PORTD
for (int i=0;i<10;i++)
{
PORTD = binary_pattern[i];
__delay_ms(1000); //add delay of one second
}
}
return;
}

3.WAP for finding the even numbers among 10,8 bit numbers.

.model small
.data
arr1 db 1,2,3,1,3,5,6,3,4,5
OddArr db 10 dup(?)
EvenArr db 10 dup(?)
OddAdd db 0
EvenAdd db 0

.code
mov ax,@data
mov ds,ax

LEA BX,arr1
LEA SI,OddArr
LEA DI,EvenArr
mov cx,10
mov dh,02

L1:
mov ah,00
mov al,[BX]
mov dl,al
div dh
cmp ah,00
je EVEN1
mov [DI],dl
add OddAdd,dl
INC DI
INC BX
Loop L1
jmp CAL

EVEN1:
mov [SI],dl
add EvenAdd,dl
INC SI
INC BX
Loop L1

CAL:
mov ax,0000
mov bx,0000
mov al,OddAdd
mov bl,EvenAdd

mov ax,4C00h
int 21h

end

4.What is interrupt latency and significance of a PIC


microcontroller with the help of timing diagram.
The time from the occurrence of interrupt (the interrupt flag bit
gets set ) to the time that the instruction at address 0004h starts
execution (when the interrupt is enabled) is defined as interrupt
latency. This delay is due to both software and hardware. The first
instruction of ISR is not really the instruction of interrupt source’s
handler. The first step in ISR is to identify the interrupt source by
checking the flag bit. Once identified, it will branch to ISR address.
While executing an ISR, the other interrupts are disabled and
hence delayed. So, the execution time of ISR is critical as it may
lead to missing some important interrupts. Servicing of interrupts
must not be delayed beyond the limit imposed by the timing
requirement of the source.
In short, interrupt latency is an important design parameter for
Embedded Systems, as these systems are expected to work
without any human intervention and are supposed to meet the
deadline imposed by the peripheral device/actuators. Therefore
the systems should be designed for
: Minimum frequency of interrupts from the same source.
: Maximum time taken by the CPU to execute interrupt source’s
handler.

5. Write instructions to initialize 4 pins of port A as digital o/p


pins and remaining 4 pins as analog inputs.
BANKSEL PORTA ; Bank 0
CLRF PORTA ; Reset Port A Before Configure
BANKSEL ADCON1 ; Bank 1
MOVLW 0x06 ; Select “All Digital” on Port A
MOVWF ADCON1 MOVLW 0x38 ; RA(0,1,2,3) = in
MOVWF TRISA ; RA(4,5,6,7) = out
BANKSEL PORTA ; Bank 0

6. Write instructions to initialize Timer 0 ,1 and 2 of PIC


microcontroller for generating a delay.
Timer 0
;initialize
Org 0010
Start bsf status,5; select memory bank 1
Movlw B’00011000’
Movwf trisa
Movlw 00
Movwf trisb
Movlw b’00000010’
Movwf TMR0
Bcf status, 5

Timer 1
;initialize
Org 0010
Start bsf status,5; select memory bank 1
Movlw B’00011001’
Movwf trisa
Movlw 00
Movwf trisb
Movlw b’00011010’
Movwf TMR1
Bcf status, 5

Timer 2
Movlw d’249’
Movwf pr2,A
Bsf RCON,IPEN,A
Bsf IPR1,TMR2IP,A
Bcf PIR1,TMR2IF,A
Movlw 0*C0
Movwf T2CON,A
Bsf PIE1,TMR2IE,A

You might also like