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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/15/07 12:05
Modified:
  02/15/07 12:06

Read: times


 
Msg Score: +1
 +1 Informative
#133033 - step by step
Responding to: ???'s previous message
Let's assume you have the following contents of external code ROM:
0000  74 15   - mov a,#15h
0002  F5 90   - mov p1,a;


The following happens (not exactly, but for the purpose of ur explanation this suffices):

  1. 00 (low part of program counter PC) gets issued on P0 pins, 00 (high part of PC) on P2 pins, ALE pulses high and low (so that the low address from P0 can be latched)
  2. P0 floats, /PSEN is pulsed low so that the ROM puts the data from address 0000 (=74) onto its data bus = P0 from where the '51 latches it into its internal instruction latch.
  3. '51 decodes the instruction and finds out that it needs one more byte. Meantime, PC is incremented.
  4. 01 (PC low) onto P0, 00 (PC high) onto P2, ALE pulsed high
  5. P0 floats, /PSEN pulsed low, the byte from ROM (=15) latched in
  6. '51 further decodes the instruction, finds out that it needs to move the second latched byte into accumulator and so it does. As this instruction is done, '51 knows that the following code memory fetch is the first byte of instruction again. Meantime, PC is incremented.
  7. 02 (PC low) onto P0, 00 (PC high) onto P2, ALE pulsed high
  8. P0 floats, /PSEN pulsed low, the byte from ROM (=F5) latched in
  9. '51 decodes the instruction and finds out that it needs one more byte. Meantime, PC is incremented.
  10. 03 (PC low) onto P0, 00 (PC high) onto P2, ALE pulsed high
  11. P0 floats, /PSEN pulsed low, the byte from ROM (=90) latched in
  12. '51 further decodes the instruction, finds out that it needs to move the contents of accumulator to a directly addressed location with address given by the second byte, which is an address of a SFR (P1); writing to it changes the state of the P1 port pins.


Is it clearer now?

JW


List of 9 messages in thread
TopicAuthorDate
8031 memory interfacing            01/01/70 00:00      
   youve just answered your own question            01/01/70 00:00      
      i doubt 'movc' and 'movx'            01/01/70 00:00      
         port 1 has nothing to do...            01/01/70 00:00      
   Read the datasheet!            01/01/70 00:00      
   step by step            01/01/70 00:00      
      thanks for such a detailed Explanation Jan            01/01/70 00:00      
         yes            01/01/70 00:00      
            Ok. I would go through it.            01/01/70 00:00      

Back to Subject List