Freelance Electronics Components Distributor
Closed Dec 25th-26th
800-300-1968
We Stock Hard to Find Parts

C8051F041-GQ

Part # C8051F041-GQ
Description MCU 8BIT CISC 64KB FLASH 3V 64TQFP - Trays
Category IC
Availability In Stock
Qty 2
Qty Price
1 + $20.05559
Manufacturer Available Qty
SILICON LABORATORIES
Date Code: 0903
  • Shipping Freelance Stock: 2
    Ships Immediately



Technical Document


DISCLAIMER: The information provided herein is solely for informational purposes. Customers must be aware of the suitability of this product for their application, and consider that variable factors such as Manufacturer, Product Category, Date Codes, Pictures and Descriptions may differ from available inventory.

C8051F040/1/2/3/4/5/6/7
136 Rev. 1.5
Figure 12.3. SFR Page Stack
Automatic hardware switching of the SFR Page on interrupts may be enabled or disabled as desired using
the SFR Automatic Page Control Enable Bit located in the SFR Page Control Register (SFRPGCN). This
function defaults to ‘enabled’ upon reset. In this way, the autoswitching function will be enabled unless dis-
abled in software.
A summary of the SFR locations (address and SFR page) is provided in Table 12.2. in the form of an SFR
memory map. Each memory location in the map has an SFR page row, denoting the page in which that
SFR resides. Note that certain SFR’s are accessible from ALL SFR pages, and are denoted by the “(ALL
PAGES)” designation. For example, the Port I/O registers P0, P1, P2, and P3 all have the “(ALL PAGES)
designation, indicating these SFR’s are accessible from all SFR pages regardless of the SFRPAGE regis-
ter value.
12.2.6.3. SFR Page Stack Example
The following is an example of a C8051F040 device that sho
ws the operation of the SFR Page Stack dur-
ing interrupts.
In this example, the SFR Page Control is left in the default enabled state (i.e., SFRPGEN = 1), and the
CIP-51 is executing in-line code that is writing values to Port 5 (SFR “P5”, located at address 0xD8 on SFR
Page 0x0F). The device is also using the Programmable Counter Array (PCA) and the 8-bit ADC (ADC2)
window comparator to monitor a voltage. The PCA is timing a critical control function in its interrupt service
routine (ISR), so its interrupt is enabled and is set to high priority. The ADC2 is monitoring a voltage that is
less important, but to minimize the software overhead its window comparator is being used with an associ-
ated ISR that is set to low priority. At this point, the SFR page is set to access the Port 5 SFR (SFRPAGE =
0x0F). See Figure 12.4 below.
SFRNEXT
SFRPAGE
SFRLAST
Interrupt
Logic
C8051F040/1/2/3/4/5/6/7
Rev. 1.5 137
Figure 12.4. SFR Page Stack While Using SFR Page 0x0F To Access Port 5
While CIP-51 executes in-line code (writing values to Port 5 in this example), an ADC2 Window Compara-
tor Interrupt occurs. The CIP-51 vectors to the ADC2 Window Comparator ISR and pushes the current
SFR Page value (SFR Page 0x0F) into SFRNEXT in the SFR Page Stack. The SFR page needed to
access ADC2’s SFR’s is then automatically placed in the SFRPAGE register (SFR Page 0x02). SFRPAGE
is considered the “top” of the SFR Page Stack. Software can now access the ADC2 SFR’s. Software may
switch to any SFR Page by writing a new value to the SFRPAGE register at any time during the ADC2 ISR
to access SFR’s that are not on SFR Page 0x02. See Figure 12.5.
0x0F
(Port 5)
SFRPAGE
SFRLAST
SFRNEXT
SFR Page
Stack SFR's
C8051F040/1/2/3/4/5/6/7
138 Rev. 1.5
Figure 12.5. SFR Page Stack After ADC2 Window Comparator Interrupt Occurs
While in the ADC2 ISR, a PCA interrupt occurs. Recall the PCA interrupt is configured as a high priority
interrupt, while the ADC2 interrupt is configured as a low priority interrupt. Thus, the CIP-51 will now vector
to the high priority PCA ISR. Upon doing so, the CIP-51 will automatically place the SFR page needed to
access the PCA’s special function registers into the SFRPAGE register, SFR Page 0x00. The value that
was in the SFRPAGE register before the PCA interrupt (SFR Page 2 for ADC2) is pushed down the stack
into SFRNEXT. Likewise, the value that was in the SFRNEXT register before the PCA interrupt (in this
case SFR Page 0x0F for Port 5) is pushed down to the SFRLAST register, the “bottom” of the stack. Note
that a value stored in SFRLAST (via a previous software write to the SFRLAST register) will be overwritten.
See Figure 12.6 below.
0x02
(ADC2)
0x0F
(Port 5)
SFRPAGE
SFRLAST
SFRNEXT
SFRPAGE
pushed to
SFRNEXT
SFR Page 0x02
Automatically
pushed on stack in
SFRPAGE on ADC2
interrupt
PREVIOUS3940414243444546474849505152NEXT