  We develop a method to determine accurately the binding energy of the X(3872)
from lattice data for the $D \bar D^*$ interaction. We show that, because of
the small difference between the neutral and charged components of the X(3872),
it is necessary to differentiate them in the energy levels of the lattice
spectrum if one wishes to have a precise determination of the the binding
energy of the X(3872). The analysis of the data requires the use of coupled
channels. Depending on the number of levels available and the size of the box
we determine the precision needed in the lattice energies to finally obtain a
desired accuracy in the binding energy.
