Implementation of coulomb counting
Current (I) = rate of change of charge (\$\dfrac{dq}{dt}\$) so integrate your current with respect to time. 

1 amp flowing for one second is the delivery of 1 coulomb of charge. If you are sampling current at (say) every 10 milliseconds I'd consider using an analogue integrator and resetting it every 10 milliseconds just after sampling the integrator's output.