Problem when using Progmem to read data (Need Help)

Have anyone know the problem with my code? I used this code for fuel level project with metrology data table as table refrences. I tried to use Progmem to store all the data tables, but when i running the code still not returning the right data.
This my Sample Code :

#include <avr/pgmspace.h>
PROGMEM prog_int32_t datax[]={31,63,94,154,217,270,323,376,443,523,604,692,781,
869,966,1070,1173,1289,1409,1528,1644,1760,1892,2035,2171,2300,2430,2558,
2683,2808,2936,3079,3222,3375,3542,3708,3833,3958,4083,4208,4388,4567,4746,
4918,5090,5263,5435,5607,5780,5953,6126,6293,6455,6617,6781,6949,7116,7293,
7486,7679,7851,8019,8186,8387,8596,8786,8948,9110,9281,9475,9668,9851,10030,
10209,10404,10600,10797,10993,11190,11383,11576,11769,11961,12154,12347,12539,
12732,12942,13117,13308,13497,13685,13874,14063,14253,14447,14642,14836,15031,
15225,15420,15614,15809,16004,16198,16393,16587,16782,16976,17171,17365,17560,
17754,17949,18144,18338,18533,18727,18922,19116,19311,19505,19700,19894,20089,
20284,20478,20673,20867,21062,21256,21451,21645,21840,22034,22229,22423,22618,
22813,23007,23202,23396,23591,23785,23980,24174,24369,24563,24758,24953,25147,
25342,25536,25731,25925,26120,26314,26509,26703,26898,27093,27287,27482,27676,
27871,28065,28260,28454,28649,28843,29038,29233,29427,29622,29816,30011,30205,
30400,30594,30789,30983,31178,31373,31568,31763,31958,32153,32348,32543,32738,
32933,33128,33323,33518,33713,33908,34103,34298,34493,34688,34883,35078,35273,
35468,35663,35858,36053,36248,36443,36638,36833,37028,37223,37418,37613,37808,
38003,38198,38393,38588,38783,38978,39173,39370,39567,39764,39961,40158,40358,
40560,40761,40950,41139,41328,41518,41707,41901,42096,42291,42482,42674,42862,
43049,43235,43428,43621,43813,43999,44185,44367,44547,44726,44906,45087,45267,
45446,45626,45812,46020,46229,46396,46552,46706,46875,47048,47222,47391,47558,
47725,47885,48041,48198,48354,48511,48668,48824,48976,49128,49281,49432,49583,
49716,49848,49980,50113,50245};
int i=0;
void setup() 
{
  Serial.begin(9600);

}
void loop() 

{
while (i != 285)
{
  Serial.println(i);
  Serial.println(datax[i]);
  i++;
  delay(1000);
}
}

Try:

#include <avr/pgmspace.h>

//PROGMEM unsigned int datax[]= //OR
PROGMEM prog_uint16_t datax[]={
  31,63,94,154,217,270,323,376,443,523,604,692,781,
  869,966,1070,1173,1289,1409,1528,1644,1760,1892,2035,2171,2300,2430,2558,
  2683,2808,2936,3079,3222,3375,3542,3708,3833,3958,4083,4208,4388,4567,4746,
  4918,5090,5263,5435,5607,5780,5953,6126,6293,6455,6617,6781,6949,7116,7293,
  7486,7679,7851,8019,8186,8387,8596,8786,8948,9110,9281,9475,9668,9851,10030,
  10209,10404,10600,10797,10993,11190,11383,11576,11769,11961,12154,12347,12539,
  12732,12942,13117,13308,13497,13685,13874,14063,14253,14447,14642,14836,15031,
  15225,15420,15614,15809,16004,16198,16393,16587,16782,16976,17171,17365,17560,
  17754,17949,18144,18338,18533,18727,18922,19116,19311,19505,19700,19894,20089,
  20284,20478,20673,20867,21062,21256,21451,21645,21840,22034,22229,22423,22618,
  22813,23007,23202,23396,23591,23785,23980,24174,24369,24563,24758,24953,25147,
  25342,25536,25731,25925,26120,26314,26509,26703,26898,27093,27287,27482,27676,
  27871,28065,28260,28454,28649,28843,29038,29233,29427,29622,29816,30011,30205,
  30400,30594,30789,30983,31178,31373,31568,31763,31958,32153,32348,32543,32738,
  32933,33128,33323,33518,33713,33908,34103,34298,34493,34688,34883,35078,35273,
  35468,35663,35858,36053,36248,36443,36638,36833,37028,37223,37418,37613,37808,
  38003,38198,38393,38588,38783,38978,39173,39370,39567,39764,39961,40158,40358,
  40560,40761,40950,41139,41328,41518,41707,41901,42096,42291,42482,42674,42862,
  43049,43235,43428,43621,43813,43999,44185,44367,44547,44726,44906,45087,45267,
  45446,45626,45812,46020,46229,46396,46552,46706,46875,47048,47222,47391,47558,
  47725,47885,48041,48198,48354,48511,48668,48824,48976,49128,49281,49432,49583,
  49716,49848,49980,50113,50245};
int i=0;
unsigned int num;
void setup() 
{
  Serial.begin(9600);

}
void loop() 

{
  //while (i < 286)  //OR
  //while (i < sizeof(datax)/2) //OR
  while (i < sizeof(datax)/sizeof(unsigned int))
  {
    num = pgm_read_word_near(datax + i);
    Serial.print(i);
    Serial.print(" ");
    Serial.println(num);
    i++;
    delay(100);
  }
}

Okey Larry .. Thx for your help :slight_smile:
Your Script has been successfully running