Explain what the following code segment is doing Assume that

Explain what the following code segment is doing. Assume that the various register names and register bit names have been previously defined: BANKSEL TRISB BSF TRISB, O BSF OPTIONS REG, INTEDG BCF INTCON, INTF BSF INTCON INTE BSF INTCON, GIE

Solution

BANSEL TRISB------> Select the bank containing TRISB

BSF TRISB,0 -------> Make TRISB0 is an input pin

BSF OPTIONS_REG,INTEDG-----> Enable inerrupt on raising edge of int ping

BCF INTCON, INTF --------> Its clear the inerrupt flag

BSF INTCON, INTE-------->Enable TRISB0 for external interrupt

BSF INTCON,GIE----------> Enable Global Interrupt

The whole program code is doing that,TRISB0 is an input pin mapped to the addressing of banksel and enable interrupt to raising edge and enable external interrupt and global interrupt and finally clear the interrupt.

 Explain what the following code segment is doing. Assume that the various register names and register bit names have been previously defined: BANKSEL TRISB BSF

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site