kloppy
Joined: 28 Jul 2004 Posts: 32
|
problem with const struct array |
Posted: Wed Sep 01, 2004 1:12 am |
|
|
is the constant struct array battery_dat[] too big for ccs??
my program works fine until i call the line: Code: | {"data.........9","mAh",9,1,900,9}, |
Code: | char to_print[20];
typedef struct {
char data_name[20];
char unit[6];
int address;
short read_type; //same as int1
long _100_percent;
int marker;
}bat_data;
//#org 0x1800,0x1fff
const bat_data battery_data[]=
{{"data.........1","mAh",1,1,100,1},
{"data.........2","V ",2,1,200,2},
{"data.........3","mAh",3,1,300,3},
{"data.........4","V ",4,1,400,4},
{"data.........5","mAh",5,1,500,5},
{"data.........6","V ",6,1,600,6},
{"data.........7","mAh",7,1,700,7},
{"data.........8","V ",8,1,800,8},
{"data.........9","mAh",9,1,900,9},
{"data........10","V ",10,1,1000,10},
{"data........11","mAh",11,1,1100,11},
{"data........12","V ",12,1,1200,12},
{"data........13","mAh",13,1,1300,13},
{"data........14","V ",14,1,1400,14},
{"data........15","mAh",15,1,1500,15},
{"data........16","V ",16,1,1600,16},
{"data........17","mAh",17,1,1700,17},
{"data........18","V ",18,1,1800,18},
{"data........19","mAh",19,1,19000,19},
{"data........20","V ",20,1,20000,20}};
lcd_write_instruction(line_1);
strcpy(to_print,battery_data[position-1].data_name);
printf(lcd_write_data,"%s",to_print);
printf("%4u%s\n\r",position,to_print);
lcd_write_instruction(line_2);
strcpy(to_print,battery_data[position-1].unit);
printf(lcd_write_data,"%4u%s",position,to_print);
printf("%4u%s\n\r",position,to_print); |
the output on the lcd and the hyperterminal (rs232) is:
when position is 7:
7data.........7
7mAh
when position is 8:
8data.........8
8V
when position is 9:
9data....data.........
9.1
i tryed the before the const struct but the problem is still the same.... |
|