1. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Hi all,

    Can someone please explain to me why the memory is divided into three sectors (i.e. 'direct data', 'indirect data' and 'direct or indirect data' ) ?

    What is saved in each of these three sectors?

    Thanks in advance.
     
  2. DickCappels

    Moderator

    Aug 21, 2008
    2,653
    632
    It is not a matter of where the data are stored; it is a matter of the means of accessing the data.

    With direct addressing, the data is contained in the instruction.
    Example: mov a,20h This puts the value 20h into the accumulator.

    With indirect addressing the data is contained at a location specified by a register.
    Example: mov a, @r0 This puts the data to which register r0 points into the accumulator.



     
    cmartinez and Dritech like this.
  3. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Thanks for the reply. Am I correct in saying that address range from 0h to 7Fh can be accessed using both direct or indirect addressing, while address range 80h to FFh can only be accessed using indirect addressing?
    If so, why is the memory range from 80h to FFh accessible only using indirect addressing?

    Thanks in advance.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    You are correct. The answer to your other question involves a clever trick. There is the possibility of having RAM from 00h to 0FFh, and in addition the SFRs are overlaid on the range 80h to 0FFh. Now for the trick, SFRs are only accessible via direct addressing. Indirect addressing in that range goes to RAM. For the range 00h to 7Fh, both types of addressing, direct and indirect, go to RAM. With 8 bits of address you get 384 different locations.

    Got it?
     
    Dritech likes this.
  5. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    So in the range from 80h to FFh, the user has to use direct or indirect to indicate whether to access the RAM area or the SFR ?
    The SFR is still part of the RAM right?

    Another quick question related to timers. What is the meaning of "timer capture or reload"?

    Thanks and sorry for my poor English.
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    The Special Function Registers are different than RAM. With RAM you should always read back what you last wrote to a location. Because SFRs are connected to hardware and not memory this is not always the case. It is possible to write an SFR and read back something different.

    Timer Capture refers to reading or "capturing" the value of a timer upon the occurence of a specific event, like a rising edge or a falling edge. The difference between the two values is the amount of time, in "timer ticks", between the two events.

    Timer Reload is what happens when an event causes the timer to reload a particular value to create periodic events.
     
    Dritech likes this.
  7. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Thanks for the reply. Can someone please explain what is the use of the T2OE and the DCEN bits in the T2MOD register?

    Does the circuit act as a down-counter if DCEN is cleared?

    I did check the 0851 datasheet but didn't understant what is actually meant by "Clear to program P1.0/T2 as clock input or I/O port. Set to program P1.0/T2 as clock output".
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    DCEN allows T2 to be an up counter OR a down counter. T2EX controls the direction, up or down.

    T2OE allows the pin to have two possible functions, and you have to chooses which one you want. Either T2 Clock Out or I/O port.

    Check out the diagrams on pp. 2-89 thru 2-91

    http://www.atmel.com/images/doc4316.pdf
     
  9. thar07

    Member

    Jan 3, 2015
    71
    0
  10. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,572
    2,537
    Check this document, it explains the internal memory organization of your typical 8051
     
Loading...