Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The source code needs to be amended to use interrupts. Please do in the Assembly language, the PIC16F886 devboard is used. The source code is

The source code needs to be amended to use interrupts. Please do in the Assembly language, the PIC16F886 devboard is used. The source code is attached below.

image text in transcribed

#include #define SW2 PORTB, 5 __CONFIG _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT __CONFIG _CONFIG2, _WRT_OFF & _BOR21V cblock 0x70 D1 D2 endc ORG 0 ;call Init_D3 start: banksel ANSELH ; CLRF ANSELH; MOVLW B'00000000' ; MOVWF ANSELH; banksel PORTB CLRF PORTB banksel TRISB MOVLW B'11110000' ; MOVWF TRISB

; banksel INTCON ; CLRF INTCON ; bsf INTCON, 7 ; bsf INTCON, 4 ; bcf INTCON, 1

LED4OnLoop: banksel PORTB call Delay_1s call Delay_1s call Delay_1s bsf PORTB, 3 bcf PORTB, 0 bcf PORTB, 1 bcf PORTB, 2 banksel PORTB btfsc SW2 goto LED4OnLoop call Delay_1s goto IntLoop IntLoop: banksel PORTB btfsc SW2 goto IntLoop bcf PORTB, 3 call Delay_1s bsf PORTB, 0 call Delay_1s bcf PORTB,0 call Delay_1s bsf PORTB, 1 call Delay_1s bcf PORTB,1 call Delay_1s bsf PORTB, 2 call Delay_1s bcf PORTB, 2 call Delay_1s bsf PORTB, 3 call Delay_1s bcf PORTB,3 goto LED4OnLoop Delay_1s: nop decfsz D1,f goto Delay_1s nop decfsz D2,f goto Delay_1s return end ;

Pre-lab Preparation (a) Connect the 28-Pin LIN Demo Board to your computer. (b) Write the code in ASSEMBLY language and program your development board to perform the following functions: (1) The on-board LED DS4 will be initially off (2) After a short period of time, LED DS4 will come on and stay on for the duration of operation (3) Utilizing the SW2 push-button, the one on Bank B, trigger an interrupt which causes functionality of the LEDS to change. - First: DS4 LED should turn off - Second: DS1 LED should blink once - Third: DS2 LED should blink once - Fourth: DS3 LED should blink once - Fifth: DS4 LED should blink once (4) Upon resuming normal operation, the DS4 LED should still be on and stat that way for the duration of operation

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions