Cannot clear interrupt flag 'IE3' on 8051

Thread Starter

umichfan1

Joined Jun 16, 2012
32
I am just learning to program in assembly using the 8051 microcontroller (specifically the Dallas DS80C320 chip), and I am working on a simple Jeopardy-style project in which I have two clickers and a reset button, and one of two LED lights turns on depending upon which clicker is clicked first.

I am writing the program for this using interrupts, so the reset button is the input for INT0, clicker A is the input for INT1, and clicker B is the input for INT3. (I went with INT3 rather than INT2 so that they would all be negative-edge triggered). I'm simulating my program on RIDE7, but I found that whenever I simulate an interrupt on INT3, I get stuck in a state in which the INT3 interrupt perpetually occurs. I figured out that this is because the flags associated with INT0 and INT1 are automatically reset after those interrupts occur, but the flag associated with INT3 is NOT reset.

According to the High Speed Microcontroller User Guide (attached), this flag is named IE3, and its description reads: "This bit will be set when a falling edge is detected on INT3. This bit must be cleared manually by software." (p. 28) The problem is, I cannot for the life of me figure out how to clear it manually by software. In the Interrupt Summary Table 9-1 of the same guide (p. 107), it says that IE3 is located at bit 5 of the EXIF register.

So in my program I issued the instruction CLR EXIF.5 . Unfortunately, this generates the following error: INVALID BYTE BASE IN BIT ADDRESS EXPRESSION. I have also tried using the address of the EXIF register, so that the instruction is CLR 91h.5 ...and this still gives exactly the same error. I have also tried MOV EXIF.5, #0 . Nothing works. Any help would be much appreciated. Thanks in advance.
 

Attachments

Last edited:

Thread Starter

umichfan1

Joined Jun 16, 2012
32
ANL EXIF, #DFH worked perfectly...thanks so much, MrChips! I see now that the problem was that for some reason, the DS80C320 chip doesn't allow you to modify individual bits in the EXIF register. You have to modify the entire register all at once. So the mask #DFH is really 11111011 in binary--in other words, set the fifth bit (out of 7, assuming zero indexing) to 0, and leave the rest of them as they are.
 

Papabravo

Joined Feb 24, 2006
21,225
ANL EXIF, #DFH worked perfectly...thanks so much, MrChips! I see now that the problem was that for some reason, the DS80C320 chip doesn't allow you to modify individual bits in the EXIF register. You have to modify the entire register all at once. So the mask #DFH is really 11111011 in binary--in other words, set the fifth bit (out of 7, assuming zero indexing) to 0, and leave the rest of them as they are.
What you found out was that individual bits in an SFR (Special Function Register) can only be manipulated in SFRs who's address is a multiple of 8. Another way of saying it is that the bit manipulation instructions work on SFRs with hexadecimal addresses in the following set:

{80, 88, 90 98, A0, A8, B0, B8, C0, C8, D0, D8, E0, E8, F0, F8}

Some of the addresses will have hardware SFRs there and some may be empty, void, and without form or function.
Thus endeth the lesson.
 
Top