Exercise
For each of the three code segments below, draw the waveform that results on output RB7. If the waveform is repeating, then say so and draw at least two cycles. Also, clearly indicate logic '0' and logic `1' on your waveforms. For all code segments, pin RB7 is connected to RBO as shown in Figure 1 below. Be sure to clearly indicate the initial state of the RB7 output.
Code 1
interrupt isr() {
if (INTOIF) (
INTOIF = 0; RB7 = 1;
}
main() (
TRISB = Ox7F; RB7 = 1;
IPEN = 0; INTEDGO = 0; INTOIF = 0; INTOIE = 1; PEIE = 1; GIE = 1; while (1) {
R87 - 0;
while (IFtB0) ;
}
Code 2
interrupt isr() I
if (INTOIF)
INTOIF = 0; RB7 = 1; INTOIE = 0;
main() {
TRISB = Ox7F; RB7 = 1;
IPEN = 0; INTEDGO = 0; INTOIF = 0; INTOIE = 1; PEIE = 1; GIE 1; while (1){
RB7 = 0;
while(!RBO);
}
Code 3
interrupt isr()
if (INTOIF) {
INTOIF = 0; RB7 = 1;
}
1
main() (
TRISB = Ox7F; RB7 = 1;
} IPEN = 0; INTEDGO = 1; INTOIF = 0; INTOIE = 1; PEIE = 1; GIE = 1;
while (1){ RB7 = 0; while(!RBO);
}