8051 段

SFRs are used in your program to control timers, counters, serial I/Os, port I/Os, and peripherals. SFRs reside from address 0x80 to 0xFF and can be accessed as bits, bytes, and words.

Classic 8051 devices support the SFR address range 0x80-0xFF. The NXP 80C51MX provides an additional extended SFR space with the address range 0x180-0x1FF.

================================================================================================================

The Cx51 Compiler supports two type qualifiers: const and volatile.

The Cx51 Compiler conforms to the ANSI definition of const objects.

  • Variables declared with the const type qualifier alone are stored in the memory area (data, idata, xdata, and so on) associated with their definition.
  • Variables you want to locate in ROM must be declared with the code memory type. For example:
    code char test[] = "This is a text string";
  • The volatile type qualifier declares an object whose value may be changed by something external to the code in which it appears. In an embedded system this would typically be hardware.

====================================

In all members of the 8051 family, the first 32 bytes of DATA memory (0x00-0x1F) is grouped into 4 banks of 8 registers each. Programs access these registers as R0-R7. The register bank is selected by two bits of the program status word, PSW.

===============================================================================================================

The using attribute is most useful in interrupt functions. Usually a different register bank is specified for each interrupt priority level. Therefore, you could assign one register bank for all non-interrupt code, a second register bank for the high-level interrupt, and a third register bank for the low-level interrupt.

On reset, the 8051 loads the PSW with 00h which selects register bank 0. By default, all non-interrupt functions use register bank 0.

=============================================================================

posted @ 2018-10-22 13:53  NothingIsEverything  阅读(198)  评论(0编辑  收藏  举报