In: Electrical Engineering
and why?
2: Store two values 0x80 and 0x08 in in file register locations 0x40 and 0x41 respectively.
Subtract content of location 0x41from 0x40 and store the result in register 0x43.
Answer:- Interrupt and polling:- In case of interrupt, the controller does its task continuously but when interrupt comes, the controller moves to the Interrupt Service Routine (ISR). After finishing the ISR, it starts the former task and runs the code from the next instruction.
In case of polling, the controller polls a condition to happen continuously. Due to this, no other code can be run. It polls for the event in a loop continuously.
Overall, interrupt is preferred over polling. In case of interrupt the controller does other task also and when interrupt comes, it executes the interrupt code also. But in case of polling a loop is executed only and if controller goes outside the loop the polling fails.
Answer:- 2) The code is-
var1 EQU 0x40 ;define variable var1 at address 0x40
var2 EQU 0x41
Result EQU 0x43
MOVLW 0x80 ;w = 0x80
MOVWF var1 ;at address 0x40 Value is 0x80
MOVLW 0x08 ;w = 0x08
MOVWF var2
MOVF var2, 0 W = 0x80
SUBWF var1, 0 ;W = 0x80 - 0x08
MOVWF Result ;keep result at 0x43