This code fragment contains some global variables, we cannot see how they are declared, initialized and probably used somewhere else. We don't see also the constants, maybe there are some comments in their definitions.
Anyway, looks like some (smoothing?) filter.
The best way to understand such code is to add logging with all variables printed, and to understand what happens reading this log. Another way is to make manual calculations with some predefined set of input data, with all code branches applied.
This code fragment contains some global variables, we cannot see how they are declared, initialized and probably used somewhere else
Thanks a lot to write here. Yes this code has global variable like Global.c. But this file explains to call internal and external memory and RAM. A summary can find here, DSP Global Variable Specification Syntax[^]
Vfilt_16 is also a register value.
About k the C2000 digital lib manual says,
Proportional gain is usually applied directly to servo error, however, a feature of this controller is that sensitivity of the proportional path to the reference input can be weighted differently from that of the feedback input. This is achieved through the Kr variable, and provides an additional degree of freedom when tuning the controller. The proportional control law is shown in Equation
v5 (k) = Krr(k) - y(k)
In most situations the weighting gain Kr will be unity.
Its a PID controller equation. Such functions are typically based on integrating the transient error over a fixed time interval.
The DCL.h library header file includes a set of default floating-point values that can be used for
initialization purposes. These configure the proportional path to have unity gain, zero integral gain, output
saturation limits of ±1.
I am a newbie here. I just want to know few things those are really hard to track down. I am trying to debug a existing F/W code mostly written in c or c++. This IDE and compiler is from a particular DSP/MCU company. This code is a complex one and F/W and S/W mixed together. Some codes are not even understandable because I have very limited knowledge in syntax, pointer datatype and flags etc. Manuals and examples can give some ideas.
Now lets talk a specific problem, .c file includes some header dependencies like those are customized, made for particular reason.
Mentioned register file is customized. I am not going to describe in detail. Before I post a portion of code I should explain a little. In this PI control we are trying to play with register values which may bring the channel voltage that relates with current in terms of different conditional case. Here we go,
Register[CURENT_LIMIT_STATUS] = CURRENT_LIMIT_STATUS_NULL;//need to know what is the current limit status in loadif(bSysRun)// This register tells to RUN the system
Voltage_ch1 -= Current_T_ch1 * Register[LINE_DROP_SCALE]; // multiplied by a scale vaule
Voltage_ch1 = Voltage_ch1 < 0 ? 0 : Voltage_ch1;// less then 0, means no loadif(Register[USE_LOADSHARE] != 0)
Voltage_ch1 -= Register[LOADSHARE_DIFF_CURRENT] * Register[LOAD_SHARE_SCALE_V];//330 no register multiplied by load share scale
Current_BP -= Register[LOADSHARE_DIFF_CURRENT] * Register[LOAD_SHARE_SCALE_B];// BAT positive end current with same load share currentif(Register[RUN_MODE] == MODE_SOLAR)
Voltage_ch2 += Register[LOADSHARE_DIFF_CURRENT] * Register[LOAD_SHARE_SCALE_B];//
What I did not understand as follows,
1. Subtract AND assignment operator, what -= means ?
2. what += means ?
3. What does !=0 means in if structure ?
4. What double equals == means ?
Now let me expain my scenrio I am running a client server TCPI /IP program the server is a z/os mainframe and the client is a MFC C\C++ windows based program which displays data from the mainframe
I can have up to 4 modeless dialog boxes which display data in a rich edit their pointers live are my derived CWinApp
I did all the front end work created the accelarator in my resource file had it as selection in my menu "MENUITEM" and put the appropriate message map and message handler in derived CDialog CProgDebug
I then inserted the following code into my derived CWinAppp CDBGRApp
After I created the CProgDebug with it rich edit the window didnt seem to take any input mouse or keyboard
Nish in his code didnt specify that after doing TranslateAccelrator and would have to do TranslateMessage and DispatchMessage from the msg structure as I assume that is being taken care of somewhere down the line by the frameWork
The function returns nonzero when it successfully translates the accelerator, which is when you should not pass the message through to the default handler. Your code is bypassing the default handler entirely when your h_accel and debug variables are set (without checking if the message was a translated keycode).
thank you so much for your patience me However the way mine is set is INCORRECT as I dont have an IF testing for the validity of the TranlateAccelarator and that is why my keyboard gets locked becasue I havr return TRUE for all
I'm looking for a way to catch exceptions due to software or hardware errors and prevent my solution from breaking brutally, but I can't find anything complete.
I have read the two main ways of handling exceptions, C ++ and SEH, but it seems to me that both do not include all cases that can happen.
Can anyone help me ?
Last Visit: 31-Dec-99 19:00 Last Update: 30-Nov-23 9:51