Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/24/04 04:53
Read: times


 
#63274 - Read-modify-write instructions
I was just going through some old 8051 notes of mine (and I can't find this information scanning through any other posts or in the tutorials anywhere) and I would like to know exactly what instructions operate on the I/O ports, P0, P1, P2, P3, in the 8051 (and I mean the 8051. The original... the one from 1980. None of this expensive P89C51RC2 stuff with 32 kilobytes of memory and lots of other suped up features) that make changes to it which are functions of the LATCH and not PIN values. In my notes, I list a bunch of examples: ANL P1, A
ORL P1, A
XRL P2, A
JBC P1.3, <label>
CPL P2.4
INC P1
DEC P2
DJNZ P1, <label>
MOV P1.4, C
CLR P2.7
SETB P1.4

And while on the surface, it may appear that these examples are fairly clear-cut, there is something duplicitous about it. What about ANL P2, #data? For instance, ANL P2, #080h. Obviously bits 0 through 6 are cleared. But is the value in the latch for P2.7 left alone, or set to the PIN value? In a PIC microcontroller, ALL read-modify-write instructions of any sort read the pin values. Even BCF 0x06, 0 will set bits 1-7 of port B if they are artificially held high the moment the instruction is executed. But the 8051 is, of course, different... but on to my point:

MUST it be A, or was I just retarded enough not to bother to include any occurrences/examples where the operator was a literal value? (I'm referring to the first 3 examples; ANL, ORL and XRL. They both move a modified A to the port... I don't have the memory to know what was going through my mind back when I took these notes, so I don't really remember what I was trying to mean.)

List of 16 messages in thread
TopicAuthorDate
Read-modify-write instructions            01/01/70 00:00      
   RE: Read-modify-write instructions            01/01/70 00:00      
   RE: Read-modify-write instructions            01/01/70 00:00      
      RE: Read-modify-write instructions            01/01/70 00:00      
         RE: Read-modify-write instructions            01/01/70 00:00      
      RE: Read-modify-write instructions            01/01/70 00:00      
         RE: Read-modify-write instructions            01/01/70 00:00      
            RE: Read-modify-write instructions            01/01/70 00:00      
               RE: Read-modify-write instructions            01/01/70 00:00      
         RE: Read-modify-write instructions            01/01/70 00:00      
         RE: Read-modify-write instructions            01/01/70 00:00      
            RE: Read-modify-write instructions            01/01/70 00:00      
      RE: Read-modify-write instructions            01/01/70 00:00      
         RE: Read-modify-write instructions            01/01/70 00:00      
            RE: Read-modify-write instructions            01/01/70 00:00      
               RE: Read-modify-write instructions            01/01/70 00:00      

Back to Subject List