| 数据搜索系统,热门电子元器件搜索 |
|
AN1069 数据表(PDF) 11 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1069 数据表(HTML) 11 Page - STMicroelectronics |
|
11 / 14 page ![]() 11/14 ADDRESSING UP TO 4 MBYTES OF EXTERNAL MEMORY 3.4 SOFTWARE IMPLEMENTATION 3.4.1 Calling functions or manipulating data in a dynamic segment Before calling a function or manipulating data in a Dynamic Segment we need to write the cor- rect value in the Port 2 data register (P2DR) to select the segment. This can be done automat- ically using a macro called “set_seg()” which is in the “extmem.h” file. This macro uses the function name or the data address as a parameter: set_seg(my_function_name) set_seg(&data_name) This macro must be used each time we want to call a function or manipulate data which is in a dynamic Segment other than the current one. It is not necessary to use this macro to call a function in the same dynamic segment as the caller function or to manipulate data in the same dynamic. Nevertheless, for data manipulation is advised to set the segment using the macro for code portability. Once this macro is implemented in your code, if you change the location of your code to another Dynamic Segment, the segment number is computed automatically. Nevertheless make sure you change the associated data segment too, since code cannot ac- cess data located in another Dynamic Segment. The number of instructions and cycles generated by this macro depends on the location of the P2DR register, it can go from 3 bytes, 6 cycles to 5 bytes 10 cycles. Depending on the DPRREM bit in the EMR2 Register, the P2DR register can be located in group E of the Reg- ister File (RF) or in group F page 21 of the RF. Read the datasheet and C-compiler manual carefully since the programming model has an impact on the DPRREM register. 3.4.2 Direct Memory Access (DMA) The following paragraph is about DMA transfer between a peripheral and memory. There are no restrictions on DMA transfer between a peripheral and the Register File. In most applications, the DMA can occur at any moment during program execution. Data to be transferred needs to be located in the Static Segment. Nevertheless, if it is really needed, we can put the data in the Dynamic Segment. But during DMA, we can only run code in the Static Segments or in the same Static Segment as the one where the data is located. 3.4.3 INTERRUPTS Interrupts can occur at any time during code execution. Therefore, interrupt vectors and rou- tines should be located in the Static Segment in order to be accessible at any time. Nevertheless, a routine from a Dynamic Segment can be called by the interrupt routine. In this case, refer to the datasheet to be sure you have configured your microcontroller to save the CSR (refer to the description of the ENCSR bit in the EMR2 register). |
|
|
链接网址 |
| 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 |