Hi Stan,
This can be done by basically keeping track of the time your read-loop takes (using tickcounts and shift-registers). Make sure you convert this time to minutes, and then multiply by the value read from the AI point. You now have the grams collected in one loop. Then, use a shift register to keep adding these grams from each loop to get the total so far.
Hope this gives you some ideas.
-Khalid