| 数据搜索系统,热门电子元器件搜索 |
|
ADE5166 数据表(PDF) 76 Page - Analog Devices |
|
|
|||||||||||||||||||||||||||||
ADE5166 数据表(HTML) 76 Page - Analog Devices |
|
76 / 148 page ![]() ADE5166/ADE5169/ADE5566/ADE5569 Preliminary Technical Data Rev. PrB | Page 76 of 148 is that the use of the general-purpose RAM can be limited to data storage. The use of the extended internal RAM can be limited to the stack, or alternatively split between the stack and data storage if more space is required. This separation limits the chance of data corruption because the stack can be contained in the upper section of the XRAM and does not overflow into the lower section containing data. Data can still be stored in extended RAM by using the MOVX command. The default starting address for the stack is 0x100, electing the upper 1792 bytes of XRAM for the stack operation. The starting address can be reconfigured to reduce the stack by writing to Bits SPH[5:3]. These three bits set the value of the three most significant bits of the stack pointer. For example, setting the SPH[5:3] to a value of 110b moves the default starting address of the stack to 0x600, allowing the highest 512 bytes of the XRAM to be used for stack operation. If the situation occurs that the stack reaches the top of the XRAM and overflows, the stack pointer rolls over to the default starting address that is written in SPH[5:3]. Care should be taken if altering the default starting address of the stack because unwanted overwrite operations may occur should the stack overflow or underflow. Stack Boundary Protection As a warning signal that the stack pointer is extending outside the specified range, a stack boundary protection feature is included. This feature is controlled through the stack boundary SFR (STCON, 0xBF) and is disabled by default. To enable this feature, the boundary protection enable bit should be set in the STCON SFR. The stack boundary protection works in two ways to protect the remainder of the XRAM from being corrupted. The waterline detection feature monitors the top of the stack and warns the user when the stack pointer is reaching the overflow point. By setting STCON[7:3], the level of the water line below the top of the XRAM can be set. For example, by setting STCON[7:3] to the maximum value of 0x1F, the waterline is set to its minimum value of 0x7FF − 0x1F = 0x7F0. Similarly, by setting STCON[7:3] to 0x1, the waterline is set at the top of the RAM space, 0x7FE. Note that if STCON[7:3] is set to 000b, then the feature is effectively disabled and no interrupt or reset is generated. The bottom of the stack is also preserved by the stack boundary feature. Should the stack pointer be written to a value lower than the default stack starting address defined in the SPH[5:3], a warning is issued and the perpetrating command is ignored. The protection for both the waterline and the stack starting address are enabled simultaneously by setting Bit 1 in the STCON SFR. When enabled, the stack boundary protection can be configured to either reset the part or trigger an interrupt when a stack viola- tion occurs. The value of STCON[2] determines the response of the part. When STCON[2] is set to 0x1 and the stack pointer exceeds the waterline, the part resets immediately no matter what other routines are in progress. If an attempt is made to move the stack pointer below the default stack starting address when STCON[2] is high, a reset also occurs. If an interrupt response is selected, the watchdog interrupt service routine is entered assuming that there is no higher level interrupt currently being serviced. It should be noted that once STCON[1] is enabled, an interrupt(or reset) triggers if the stack boundary is violated, regardless of the status of the EA bit in the IE register. This is because the watchdog interrupt is automatically configured as a high priority interrupt and, therefore, is not disabled by clearing EA. When STCON[1] is low, the feature is completely disabled and no pending interrupts are generated. There are two separate flags associated with the stack boundary protection, allowing the cause of the violation to be determined. When the waterline is exceeded, a flag is set in Bit 0 of the stack boundary SFR (STCON, 0xBF) indicating that the reset/interrupt was initiated by the stack waterline monitor. This flag remains high until the stack pointer falls below the waterline and the user clears the flag in software. A waterline or watchdog reset alone does not clear the flag. To successfully clear the flag, the software clear must occur while the stack pointer is below the waterline. Note that the stack pointer should never be altered while in the interrupt service routine because this leads to the program returning to a different section of the program and therefore malfunctioning. An external reset also causes the waterline flag to reset. When an attempt has been made to move the stack pointer below the stack starting address, a flag is set in the stack pointer high SFR (SPH, 0xB7), indicating that the reset/interrupt was initiated by the stack bottom monitor. Once again, a boundary or watchdog reset alone does not clear this flag, and the user must clear the flag in software to successfully acknowledge the event. Note that if SPH[5:3] and SPH[2:0] are altered simulta- neously to reduce the default stack starting address, when the stack boundary condition is enabled, a stack violation condition occurs and the stack bottom flag, SPH[6], is initiated. To avoid this condition, it is recommended that the default stack starting address remain at 0x100 or be increased further up the XRAM. A useful implementation of the waterline feature is to determine the amount of space required for the stack and allow a suitable default starting address to be selected. This optimizes the use of the additional XRAM space, allowing it to be used for data storage. To obtain this information, the waterline should be set to the estimated stack maximum and the interrupt enabled. If the stack exceeds the estimated maximum, the interrupt triggers, and the waterline level should be increased in the interrupt service routine. Before returning to the main program, the waterline interrupt status flag should be cleared. This program continues to jump to the waterline service routine until the stack no longer exceeds the waterline level and the maximum stack level has been determined. The stack boundary feature can be protected by clearing the second most significant bit in Flash Location 0xF7FF (see the Protecting the Flash section). If this protection bit is enabled, |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |