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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/31/03 06:23
Read: times


 
#42599 - RE: Using P2 and external RAM - Pranav
Responding to: ???'s previous message
This discussion is getting kind of comical to me.

Most designs I do today do not even use DIP switches anymore. The silly switch costs more than a 93C46 EEPROM chip....and simple remote load software communicating over the TxD and RxD lines can program the inital states into the 93C46 at time of manufacture or system setup.

BUT.........

If you connect the DIP switch to PORT2 as shown below and then read the DIP switch states at startup as:

MOV A,0FFh
MOV P2,A
MOV A,P2

...then you should immediately turn around and set the PORT 2 latch with the same data you just read like this.

MOV P2,A ;where A is value read from P2 above.

Then when you do the instruction to read external RAM you would use:

MOVX A,@R0

...No harm will come to the processor.

Just make sure to never do the instruction...

MOVX A,@DPTR or
MOVX @DPTR,A

...unless the DPH register is set equal to the value you read initially from the P2 and wrote back into the P2 latch.

--------+
  8052  |            
    P2.0|----------o  o-----+
        |                  |
    P2.1|----------o  o-----+
        |                  |
    P2.2|----------o  o-----+
        |                  |
    P2.3|----------o  o-----+
        |                  |
    P2.4|----------o  o-----+
        |                  |
    P2.5|----------o  o-----+
        |                  |
    P2.6|----------o  o-----+
        |                  |
    P2.7|----------o  o-----+
        |                   |
--------+                  GND


Michael Karas



List of 25 messages in thread
TopicAuthorDate
Using P2 and external RAM            01/01/70 00:00      
   RE: Using P2 and external RAM            01/01/70 00:00      
      RE: Using P2 and external RAM            01/01/70 00:00      
   RE: Using P2 and external RAM            01/01/70 00:00      
   RE: Using P2 and external RAM            01/01/70 00:00      
   RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
      RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
         RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
            RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
               RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                  RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                     RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                        RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                           RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                           RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                              RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
                                 RE: Using P2 and external RAM - Pranav            01/01/70 00:00      
   RE: Using P2 and external RAM            01/01/70 00:00      
      RE: Using P2 and external RAM            01/01/70 00:00      
         RE: Using P2 and external RAM            01/01/70 00:00      
            RE: Using P2 and external RAM            01/01/70 00:00      
               RE: Using P2 and external RAM            01/01/70 00:00      
               8751            01/01/70 00:00      
                  RE: 8751            01/01/70 00:00      
                     END            01/01/70 00:00      

Back to Subject List