参照
Step 1 Add library header file in the file {ProjectName}-Main.c
#include “DPLib.h”
Step 2 Declare the terminal pointers in C in the file {ProjectName}-Main.c
// —————————- DPLIB Net Pointers ———————
// Declare net pointers that are used to connect the DP Lib Macros here
// and the data variables being used by the macros internally
//DLOG_4ch – instance #1
extern volatile long *DLOG_4ch_i1Ptr;
extern volatile long *DLOG_4ch_i2Ptr;
extern volatile long *DLOG_4ch_i3Ptr;
extern volatile long *DLOG_4ch_i4Ptr;
extern volatile int16 *DLOG_4ch_buff1Ptr;
extern volatile int16 *DLOG_4ch_buff2Ptr;
extern volatile int16 *DLOG_4ch_buff3Ptr;
extern volatile int16 *DLOG_4ch_buff4Ptr;
extern volatile long DLOG_4ch_TrigVal;
extern volatile int16 DLOG_4ch_PreScalar;
extern volatile int16 DLOG_4ch_Size;
Step 3 Declare signal net nodes/ variables in C in the file {ProjectName}-Main.cc Note that the DLOG_SIZE is a #define in the {ProjectName}-Settings.h and can be modified if needed. Note these signal nets name may change from system to system, there is no dependency on the signal net names to the
Step 4 “Call” the DPL_CLAInit() to initialize the macros and “connect” the module terminals to the signal nets in “C” in {ProjectName}-Main.c
Step 5 Add the ISR assembly file “{ProjectName}-DPL-ISR.asm” to the project
Step 6 Include the macro’s assembly file in the {ProjectName}-DPL-ISR.asm
Step 7 Instantiate the INIT macro in assembly (this is one-time pass through code) inside the C-callable DPL_Init() function which is defined in{ProjectName}-DPL-ISR.asm
;Macro Specific Initialization Functions
DLOG_4ch_INIT 1 ; DLOG_4CH Initialization
Step 8 Call the run time macro in assembly inside the C-callable function DPL_ISR() which is the looped or ISR code. The function is defined in{ProjectName}-DPL-ISR.asm ;
”Call” the Run macro
DLOG_4ch 1 ; Run the DLOG_4CH Macro
Step 9 Include the memory sections in the {DeviceName}-{RAM/FLASH}- {ProjectName}.CMD. Note that the net pointers and the internal data are forced to be placed in a single data page by use of the .usect directive in the source file of the module.
/*DLOG_4ch sections*/ DLOG_4ch_Section : > dataRAM PAGE = 1
为什么DBUFF1,DBUFF2,DBUFF3,DBUFF4不更新值了,需要怎么调试
Susan Yang:
请问能否给出您的相关代码呢?
一般都是
// Initialize DATALOG moduledlog.iptr1 = &DlogCh1;dlog.iptr2 = &DlogCh2;dlog.iptr3 = &DlogCh3;dlog.iptr4 = &DlogCh4;dlog.trig_value = 0x1;dlog.size = 0x0C8;dlog.prescalar = 5;dlog.init(&dlog);然后在main_ISR()中调用类似下面的代码
/ ------------------------------------------------------------------------------ //Connect inputs of the DATALOG module// ------------------------------------------------------------------------------DlogCh1 = (int16)_IQtoIQ15(svgen1.Ta);DlogCh2 = (int16)_IQtoIQ15(svgen1.Tb);DlogCh3 = (int16)_IQtoIQ15(svgen1.Tc);DlogCh4 = (int16)_IQtoIQ15(svgen1.Tb-svgen1.Tc);
/ ——————————————————————————
// Connect inputs of the DATALOG module
// ——————————————————————————
DlogCh1 = (int16)_IQtoIQ15(svgen1.Ta);
DlogCh2 = (int16)_IQtoIQ15(svgen1.Tb);
DlogCh3 = (int16)_IQtoIQ15(svgen1.Tc);
DlogCh4 = (int16)_IQtoIQ15(svgen1.Tb-svgen1.Tc);