This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

bad structure declaration?

i'm trying to create an array of structures but when i make more than a handful my robot doesn't work.

so in main.h i have

typedef struct SPid
{
  int dState;      	 // Last position input
  int iState;      	 // Integrator state
  int iMax, iMin;    // Maximum and minimum allowable integrator state
  int desired_value; // the desired value the PID should converge upon


  float 	iGain,    	// integral gain
        	pGain,    	// proportional gain
         	dGain;     	// derivative gain
}SPid;

extern SPid vel_Gains[];

and then in main.c
#include "MAIN.H"
struct SPid vel_Gains[5];

it barely works for vel_Gains[2], (printf looks glitchy but readable) and then vel_Gains[1] works for sure...

i'm using the small memory model btw...

is there a size limitation on global variables?

thanks,
fred

Parents
  • If you have reasons to believe that you have run out of memory check build time warnings and errors, linker generated memory map. Linker will fail with an error message if it runs out of memory.
    There could be plenty of reasons why a program doesn't work as expected. With the problem description you have provided it looks unlikely it has anything to do with memory limits.

    - mike

Reply
  • If you have reasons to believe that you have run out of memory check build time warnings and errors, linker generated memory map. Linker will fail with an error message if it runs out of memory.
    There could be plenty of reasons why a program doesn't work as expected. With the problem description you have provided it looks unlikely it has anything to do with memory limits.

    - mike

Children
  • hello,

    it seems like what i posted should just work... i switched to a large memory model and reconfigured everything in DAVE... (basically a fresh start with large memory model)

    it still doesn't work... when i add other modules like timers and lcd interface... all of a sudden things don't work... and only work when i remove the structure data structure...

    is there something wrong with my compiler (keil 4.xx and my board? the phytec c167?)

    note: no one from last semester was able to use structs on this board as well... maybe there is something we all don't know about... like how to configure the 64k of RAM we have... or something or another)
    cheers,
    fred

  • Your description of the problem is too vague. It's like "Something isn't working. What could it be?" The answer to this is it could be anything. You'll have to be more specific in order to get more meaningful answers. You'll have to experiment to narrow down the number of possibilites. By experimenting I mean not just adding or removing modules, that's still not specific enough.

    - mike