We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I would like to optimize speed of program performing. Therefore I want to locate some variables to DPRAM using L166 class idata. I was not successful, if I had used dynamic allocation by operator new. Please see examle of simple class below, where atribut v should be located to on-chip RAM. I use the startup code for C166/EC++ v.5.01 Can anybody help me? Do I have to redefine malloc function? Pavel
#define NULL 0L typedef unsigned short UI_16; typedef signed short SFRAC_16; typedef SFRAC_16 near SFRAC_16N; typedef SFRAC_16 idata SFRAC_16I; class DLS // implements general discrete linear system // with internal (state) description { protected: UI_16 order; // order of DLS const SFRAC_16N *c; // pointer to coefficients of transfer function SFRAC_16I *v; // pointer to state variables public: DLS(); // default constructor - don't use! DLS(UI_16 _order, // parametric constructor - initialization const SFRAC_16N *c); ~DLS(); // destructor void clearState(); // clear state variables }; DLS :: DLS() : order(0), c(NULL), v(NULL) {} DLS :: DLS(UI_16 _order, const SFRAC_16N *_c) : order(_order), c(_c), v(new SFRAC_16I[this->order]) { clearState(); } DLS :: ~DLS() { // delete[] v; // ??? 051114 doesn't work in Keil uVision delete v; } void DLS :: clearState() { for (UI_16 i = 0; i < order; i++) { v[i] = 0; } }