Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 6 - Programming Techniques > 6.4. Register Operations - Pg. 120

120 Chapter 6 (a) INT1 Initialize Ports & Interrupt (c) ISR Save current LEDs value Increment LEDs Switch on all LEDs DELAY NO Restart Input = 0? (b) DELAY Load Timer register with FF Restore previous LEDs value Re-enable interrupt Decrement NO Return Timer zero? Return Figure 6.5 INT1 interrupt program flowcharts: (a) main sequence; (b) delay subroutine; (c) interrupt service routine them. Therefore, when an interrupt is requested, these individual interrupt bits must be checked in the software to see which is active before calling the appropriate ISR. The stack will still only hold eight return addresses, meaning that only eight levels of interrupt or subroutine are allowed. The limit of eight levels of subroutine or interrupt can easily be exceeded if the program is too highly structured (i.e. multiple subroutine levels), so this must be borne in mind when planning the program design. Higher power PIC chips have deeper stacks. 6.4. Register Operations We will now briefly review some of the options available when using the file registers, which provide more flexibility in programming.